Number constants

suggest change

The Number constructor exposes constants that describe JavaScript's IEEE 754 double-precision number type:

Number.MAX_VALUE;          // Largest finite positive number
Number.MIN_VALUE;          // Smallest positive nonzero number
Number.MAX_SAFE_INTEGER;   //  9007199254740991
Number.MIN_SAFE_INTEGER;   // -9007199254740991
Number.EPSILON;            // Difference between 1 and the next larger number
Number.POSITIVE_INFINITY;  // Infinity
Number.NEGATIVE_INFINITY;  // -Infinity
Number.NaN;                // NaN

MIN_VALUE is not the most negative number; it is the positive value closest to zero. Use -Number.MAX_VALUE for the lowest finite number.

Integers outside the safe-integer range can no longer all be represented exactly. Use Number.isSafeInteger() to validate integer inputs and use BigInt when exact larger integers are required. Floating-point spacing also grows with magnitude, so Number.EPSILON is not a universal tolerance for comparing arbitrary numbers; scale a tolerance to the values and the application's error requirements.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents