D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21601 - std.math : pow(float/double, -2) produces sometimes wrong result
Summary: std.math : pow(float/double, -2) produces sometimes wrong result
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2021-02-01 18:46 UTC by Berni44
Modified: 2021-03-01 13:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Berni44 2021-02-01 18:46:24 UTC
Both unittests fail:

import std.math : pow;

unittest
{
    assert(pow(-513645318757045764096.0f,-2) > 0.0);
    assert(pow(-1.6299717435255677e+154,-2) < 0.0);
}
Comment 1 Berni44 2021-02-01 19:04:04 UTC
Ups, should be "> 0.0" in the second test.
Comment 2 Dlang Bot 2021-02-02 10:31:21 UTC
@berni44 created dlang/phobos pull request #7783 "Fix Issue 21601 - std.math : pow(float/double, -2) produces sometimes wrong result" fixing this issue:

- Fix Issue 21601 - std.math : pow(float/double, -2) produces sometimes
  wrong result

https://github.com/dlang/phobos/pull/7783
Comment 3 Dlang Bot 2021-03-01 13:50:52 UTC
dlang/phobos pull request #7783 "Fix Issue 21601 - std.math : pow(float/double, -2) produces sometimes wrong result" was merged into master:

- bab6c2b2114c067fac127b9291c2f7fd98d3ae53 by berni44:
  Fix Issue 21601 - std.math : pow(float/double, -2) produces sometimes
  wrong result

https://github.com/dlang/phobos/pull/7783