I'm using a server-side calculation which needs to generate (with *
and +
operations) and compare 40-bit integers. I'm aware that at that point the V8 engine stores the numbers as Double
rather than int
. Can I rely on these numbers to be generated and compared correctly?
My intuition says yes - doubles shouldn't have trouble with that - but I'm not sure how to check or where to find information on this.
A JavaScript Number
, which is a 64-bit IEEE 754 floating point value, can store integers from -253 to 253 without loss of precision, since doubles can store up to 53 bits of mantissa (52 explictly).
References: