nan or -nan?

Walter Bright newshound2 at digitalmars.com
Fri Nov 18 16:22:46 PST 2011


On 11/18/2011 1:32 PM, Paul D. Anderson wrote:
> From the Decimal Arithmetic Specification
> (http://speleotrove.com/decimal/decarith.pdf):
>
> "All special values may have a sign, as for finite numbers. The sign of an
> infinity is significant (that is, it is possible to have both positive and
> negative infinity), and the sign of a NaN has no meaning, although it may be
> considered part of the diagnostic information."

Having no meaning means it is legitimate to not be concerned if the sign is toggled.


> In addition, the specification, based on IEEE 754 and IEEE 854, makes a
> distinction between a "signaling NaN" (sNaN) and a "quiet NaN" (qNaN). D
> doesn't make this distinction. In essence all D NaNs are signaling.

Signaling vs quiet is not set by the sign bit, but by the most significant bit 
of the significand. D does make use of signaling NaNs as they are what are 
generated for uninitialized data.

Other than that, the payloads are not used. I did support them in Digital Mars 
C, but nobody used them.


More information about the Digitalmars-d mailing list