[Issue 2746] Make float.init signalling NaN by default

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 20 07:14:13 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2746





------- Comment #2 from clugdbug at yahoo.com.au  2009-03-20 09:14 -------
(In reply to comment #1)
> I'll put it in, but there's a problem if the compiler does any constant folding
> on the values - they'll get converted to quiet NaNs.

I know. I don't think it's too unreasonable: once you've done a calculation on
it, it's no longer uninitialized. The only way it could get constant-folded is
if you've explicitly entered 'real.init'. So you'd have to be doing something
peculiar.
(Negation still preserves signallingness, through the ancient code in DMD; and
there, you're just setting the sign bit).

Since it only SNANs automatically get converted to QNANs when no traps are
enabled, and since no-one expects traps to be enabled at compile time, it's
quite defensible, I think.


-- 



More information about the Digitalmars-d-bugs mailing list