javascript - Why does typeof NaN return 'number'? -
javascript - Why does typeof NaN return 'number'? -
just out of curiosity.
it doesn't seem logical typeof nan number. nan === nan or nan == nan returning false, way. 1 of peculiarities of javascript, or there reason this?
edit: answers. it's not easy thing ones head around though. reading answers , wiki understood more, still, sentence
a comparing nan returns unordered result when comparing itself. comparing predicates either signaling or non-signaling, signaling versions signal invalid exception such comparisons. equality , inequality predicates non-signaling x = x returning false can used test if x quiet nan.
just keeps head spinning. if can translate in human (as opposed to, say, mathematician) readable language, gratefull.
it means not number. not peculiarity of javascript mutual computer science principle.
from http://en.wikipedia.org/wiki/nan:
there 3 kinds of operation homecoming nan:
operations nan @ to the lowest degree 1 operand
indeterminate forms
the divisions 0/0, ∞/∞, ∞/−∞, −∞/∞, , −∞/−∞ the multiplications 0×∞ , 0×−∞ the powerfulness 1^∞ the additions ∞ + (−∞), (−∞) + ∞ , equivalent subtractions.real operations complex results:
the square root of negative number the logarithm of negative number the tangent of odd multiple of 90 degrees (or π/2 radians) the inverse sine or cosine of number less −1 or greater +1.all these values may not same. simple test nan test value == value false.
javascript
Comments
Post a Comment