Question

How can it be possible, Chrome flooring the last 1 in a long number:

var a = 12345678987654321;
console.log("a =",a); // Traces: 12345678987654320 

Fiddle: http://jsfiddle.net/zAXLx/

enter image description here

Was it helpful?

Solution

All numbers in JavaScript are IEEE-754 double-precision numbers, which have a maximum number of ~15 significant digits. It's not Chrome, it's the nature of IEEE-754 double-precision floating point. When numbers get really big like that, they start becoming imprecise.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top