Why do some T.init evaluate to true while others to false?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 27 08:07:50 PDT 2016


On Friday, 27 May 2016 at 14:56:28 UTC, ArturG wrote:
>    float f;
>    if(f is float.init) "float init".writeln;
>    f = float.nan;
>    if(f is float.init) "float nan".writeln;

You changed it to a value that isn't float.init, so of course it 
isn't going to match!

float.nan and float.init are NOT the same thing. float.init is a 
kind of NAN, but not the same kind.


More information about the Digitalmars-d-learn mailing list