float.nan is not itself ?

Simen Kjærås simen.kjaras at gmail.com
Tue Feb 14 13:19:07 PST 2012


On Tue, 14 Feb 2012 16:39:37 +0100, Joshua Reusch <yoschi at arkandos.de>  
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

My favorite explanation: Would you expect this to pass?

assert( sqrt(-1.0) == 0.0 / 0.0 );


More information about the Digitalmars-d-learn mailing list