float.nan is not itself ?
bearophile
bearophileHUGS at lycos.com
Tue Feb 14 08:14:45 PST 2012
Joshua Reusch:
> why does this assertion fail:
>
> > assert(float.nan == float.nan);
By design, the hardware that manages floating point numbers makes a NaN not equal to everything else, including other NaNs:
http://en.wikipedia.org/wiki/NaN
In D2 "is" performs a bitwise comparison, but keep in mind there are many different NaNs (I think double.nan and double.init are different in the bits too).
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list