Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.isNumber returns true on NaN #336

Open
BlueEyedRhino opened this issue Oct 12, 2017 · 1 comment
Open

Object.isNumber returns true on NaN #336

BlueEyedRhino opened this issue Oct 12, 2017 · 1 comment

Comments

@BlueEyedRhino
Copy link

BlueEyedRhino commented Oct 12, 2017

Which is extremely funny if you think about it. Interesting it hasn't been noticed until now, but its rather rare situation I suppose. And this project is dead. Unfortunately.

Object.isNumber(NaN)
true

@ta2edchimp
Copy link

Well, NaN is the value of a variable of type Number, that is "not a number".
It's not that it hasn't been noticed until now (see StackOverflow) — it's according to the specs (JS type Number is an IEEE 754 float.

Think, for example, of parseInt(input) as a function with a return value of type Number and with an input value that cannot be parsed as a numeric value.
The return value must be of type Number, but does not need to be of a numeric value, thus NaN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants