The Joy of Signalling NaNs! (A compiler patch)

Don nospam at nospam.com
Thu Mar 19 01:04:26 PDT 2009


dennis luehring wrote:
> i talked about the signaling NaN exception "feature" to coworkers 
> yesterday - and was dreaming about a D support of them :-)
> 
> they are absolutely great if you writing math code all the time - im 
> getting tired of writing ::is_nan into my c++ functions to prevent chaos

Yup, I've had many NaN nightmares. Whenever you have an uninitialized 
variable in C++ there's about a 1% chance that it's a NaN. That's really 
fun to track down. NOT.
I think it's criminal that this feature has been in hardware since *** 
1980 *** and not made available even in systems languages.

BTW, the line numbers I gave were for DMD2, but should also work for 
DMD1. Dual license Artistic/GPL, since it's from the DMD front-end.
Only tested on Windows, I believe it should be OK on Linux and OSX, but 
someone should check.




More information about the Digitalmars-d mailing list