Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
25
rated 0 times [  31] [ 6]  / answers: 1 / hits: 15347  / 9 Years ago, thu, january 14, 2016, 12:00:00

Number.MAX_SAFE_INTEGER
9007199254740991



Number.MAX_VALUE
1.7976931348623157e+308




I understand how MAX_SAFE_INTEGER is computed based on JavaScript's double precision floating point arithmetic, but where does this huge max value come from? Is it the number that comes about if you're using all 63 bits for the exponent instead of the safe 11 bits?


More From » integer

 Answers
18

Number.MAX_SAFE_INTEGER is the largest integer which can be used safely in calculations.



For example, Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2 is true — any integer larger than MAX_SAFE_INTEGER cannot always be represented in memory accurately. All bits are used to represent the digits of the number.



Number.MAX_VALUE on the other hand is the largest number possible to represent using a double precision floating point representation. Generally speaking, the larger the number the less accurate it will be.



More information double-precision floating point numbers on Wikipedia


[#63733] Tuesday, January 12, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
xavier

Total Points: 711
Total Questions: 91
Total Answers: 121

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
;