The Joy of Signalling NaNs! (A compiler patch)

Don nospam at nospam.com
Thu Mar 19 13:11:41 PDT 2009


Walter Bright wrote:
> Georg Wrede wrote:
>> Thanks, Don and Walter!!
> 
> I originally had this in the Digital Mars C compiler years and years 
> ago. I dropped it and moved away from it because not a single person 
> noticed or cared about it, plus the standard C spec failed to 
> distinguish between quiet and signaling nan's.
> 
> I'm glad to see it actually being of value, and it's a great idea.

I noticed there was a place in the backend where it was careful to 
preserve the signallingness <g> of NaNs. So I thought, hmm, someone's 
been here before.

The key thing that makes it possible is that D initializes all floats to 
NaN anyway, and since C doesn't do that, it's not as obviously 
beneficial. By making NaN the default, you've made sure that practically 
every D user knows about them. I bet that's not the case for C/C++. (I 
even know numerical analyists who don't know much about them).



More information about the Digitalmars-d mailing list