https://issues.dlang.org/show_bug.cgi?id=13489
Ketmar Dark <ket...@ketmar.no-ip.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ket...@ketmar.no-ip.org --- Comment #3 from Ketmar Dark <ket...@ketmar.no-ip.org> --- (In reply to Walter Bright from comment #2) > Having cast(bool)d yield different results than d!=0 to me is very > surprising behavior. for me too. NaN is clearly not 0, so it's 'true'. but maybe compiler should produce warning telling programmer that he is about to summon a dragon? i.e. for implicit converts to boolean, like `if (d)` and `assert(d)` compiler will tell that "implicit convertsion of double to boolean leads to undesired results, please use explicit cast(bool)". as for '!=' vs '<>'... i don't know. it's easy to emit a warning, but i can't think out sane method to hush the compiler if "!=" is what i really want. --