D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21606 - pow(NaN,0) gives 1 not NaN
Summary: pow(NaN,0) gives 1 not NaN
Status: RESOLVED INVALID
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-03 11:40 UTC by Berni44
Modified: 2021-03-01 14:34 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-03 11:40:36 UTC
unittest
{
    assert(isNaN(pow(float.nan,0)));
    assert(isNaN(pow(double.nan,0)));
    assert(isNaN(pow(real.nan,0)));
}
Comment 1 Berni44 2021-02-03 11:42:42 UTC
I've created a fix already, but have to wait for PR #7783 to be merged.
Comment 2 Dlang Bot 2021-03-01 14:11:08 UTC
@berni44 created dlang/phobos pull request #7819 "Fix Issue 21606 - pow(NaN,0) gives 1 not NaN" fixing this issue:

- Fix Issue 21606 - pow(NaN,0) gives 1 not NaN

https://github.com/dlang/phobos/pull/7819
Comment 3 Berni44 2021-03-01 14:34:49 UTC
I just found out, that this is a weird exception of the rule, that all calculations including NaNs should be NaN...