float.nan is not itself ?

Bernard Helyer b.helyer at gmail.com
Tue Feb 14 07:48:48 PST 2012


On Tuesday, 14 February 2012 at 15:39:37 UTC, Joshua Reusch wrote:
> Hello,
>
> why does this assertion fail:
>
> > assert(float.nan == float.nan);
>
> there is the std.math.isNaN function which works correctly, but 
> why can I not just use the comparison ?
>
> Thanks, Joshua

Use `float.nan is float.nan`; all other expressions with NaNs in 
them will be false (or result in NaN).


More information about the Digitalmars-d-learn mailing list