Es-discuss - several decimal discussions

Mark S. Miller erights at google.com
Sun Aug 24 16:23:08 PDT 2008


On Sun, Aug 24, 2008 at 4:10 PM, liorean <liorean at gmail.com> wrote:
>>    const x = NaN;
>>    x === x // yields false
>>
>> Surely x holds whatever value x holds. How can this value not be the
>> same as itself?
>
> As I said, X doesn't contain any specific value, it contains a
> symbolic value representing any arbitrary value from an infinite set.

I am talking about that symbolic value. I am not talking about the
possible numeric values it represents, nor about probability
distributions. If probability distributions were relevant, would it be
acceptable for the above comparison to occasionally yield true, so
long as it happens with vanishingly now probability?

Section 8.5 of ES3 states things rather clearly:

> The Number Type The Number type has exactly 18437736874454810627 (that
> is, 264−253+3) values, representing the double-precision 64-bit format
> IEEE 754 values as specified in the IEEE Standard for Binary
> Floating-Point Arithmetic, except that the 9007199254740990 (that is,
> 253−2) distinct "Not-a-Number" values of the IEEE Standard are
> represented in ECMAScript as a single special NaN value. (Note that
> the NaN value is produced by the program expression NaN, assuming that
> the globally defined variable NaN has not been altered by program
> execution.) In some implementations, external code might be able to
> detect a difference between various Non-a-Number values, but such
> behaviour is implementation-dependent; to ECMAScript code, all NaN
> values are indistinguishable from each other.
>
> There are two *other* special values, called positive Infinity and
> negative Infinity.
[emphasis added]


--
   Cheers,
   --MarkM


More information about the Es-discuss mailing list