How many NaNs do we now have?

Waldemar Horwat waldemar at google.com
Thu Sep 4 17:11:53 PDT 2008


David-Sarah Hopwood wrote:
> Sam Ruby wrote:
>> On Mon, Aug 25, 2008 at 7:03 PM, Waldemar Horwat <waldemar at google.com> wrote:
>>> What should compareTotal do when you compare -NaN and NaN?
>> Re: the subject line; NaN's have a payload that corresponds to the
>> size of the mantissa.
> 
> No they don't; not in ECMAScript. -NaN is computationally indistinguishable
> from NaN by ECMAScript code. There is no payload and no quiet/signalling
> distinction.

That's because ECMAScript doesn't (yet) have compareTotal.  When it's added (it's mandatory in IEEE P754), then this will become an interesting question.  You will be able to tell whether -NaN somehow produces a different Nan from +NaN.

    Waldemar


More information about the Es-discuss mailing list