On 10/02/2018 03:24 PM, Basile B. wrote:
The problem is the NaN madness.
Since several values are NaN there's this strange stuff:

void main()
{
     import std.stdio;
     import std.math : isNaN;
     double d;

     writeln(d.init);    // nan
     writeln(d);         // nan
     writeln(d.nan);     // nan

     assert(d.isNaN);
     assert(d == d.nan);  // fails
     assert(d == d.init); // fails
}

the last assert is just crazy.

NaN simply isn't equal to itself. Has nothing to do with there being multiple NaNs. `d == d`, `double.nan == double.nan`, `double.init == double.init` are all false, too.

Reply via email to