3 ms·
Of all the things to complain about, he chose one that is not JavaScript's fault: the fact that NaN is a number and equality on NaN is not reflexive is a proper
by tikhonj 14y ago
Of all the things to complain about, he chose one that is not JavaScript's fault: the fact that NaN is a number and equality on NaN is not reflexive is a property of the floating point number standard.
Try it in some other language you have lying around, like Python:
>>> type(float('nan'))
<type 'float'>
>>> float('nan') == float('nan')
False
Also Haskell:
Prelude> 0/0
NaN
Prelude> 0/0 == 0/0
False
If anything, it's refreshing that JavaScript does behave like other languages in this case!