Why is NaN not finite?

Function Testing isFiniteI see that it NaNis an infinite number (even if it is not a number :-)).

isFinite(NaN) // returns false

What is the logic behind this? Why not the NaNend?

+4
source share
5 answers

As Dave Newton said, NaN is not a number, and then you must consider that it is not limited and not infinite. The same thing happens to them:

NaN > 0  // false
NaN < 0  // false

You might want to read the following articles:

+9
source

... / .

+3

Because an infinite number ... anyway a number. NaN is not a number in any possible sense.

This is like an error in the matrix.

+1
source

The result of any arithmetic operation on NaN is NaN.

The result of any logical operation on NaN is false.

+1
source

Final funds are able to be counted. It should return true or false for isFinite. I think it makes more sense for NaN to be infinite.

-3
source

Source: https://habr.com/ru/post/1525289/


All Articles