float.nan is not itself ?
Joshua Reusch
yoschi at arkandos.de
Tue Feb 14 09:39:28 PST 2012
Thank you for the explanation !
bearophile wrote:
> 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