There are five special numbers you might not expect:
- NaN: “Not a number”. This number represents “a number” that cannot be represented by the language. This is usually the result of an invalid computation (like “abc”/4). No NaN value is equal to NaN, not even the same variable. To check whether a number is in fact a NaN use the global function isNaN()
- Infinity (positive): Any “valid” number larger than the biggest number Ecmascript can represent. Adding 1 to the largest number produces infinity
- Infinity (negative)
- +0, is equal as 0 without a sign prefixed
- -0, is considered a different number from 0 or +0 (although in almost all math, they behave equally).
The exact syntax of number literals follows later.
Some methods and operators only work on integers or even positive integers. These will accept any number value but will first convert that value to their desired type using the (internal) ToInt32() and ToUINT32() functions.