Why Isn't Nan Finite?
Testing the isFinite function I see that NaN is an infinite number (even if it's not a number :-)). isFinite(NaN) // returns false What's the logic behind this? Why isn't NaN fini
Solution 1:
As Dave Newton said, NaN is not a number, and then you have to consider that it isn't finite nor infinite. The same occurs to these:
NaN > 0 // false
NaN < 0 // false
You might want to read these articles:
Solution 2:
Solution 3:
The result of any arithmetic operation on NaN is NaN.
The result of any logic operation on NaN is false.
Solution 4:
Because an infinite number... is still a number. NaN isn't a number in any possible sense.
It's like an error in Matrix.
Solution 5:
Finite means capable of being counted. It has to return true or false for isFinite. I think it makes more sense for NaN to be infinite.
Post a Comment for "Why Isn't Nan Finite?"