1

I'm facing the following issue/behavior:

console.log(1234567892012.123456);   // 1234567892012.1234
console.log(12345678920123.123456);  // 12345678920123.123
console.log(123456789201234.123456); // 123456789201234.12

What is causing this? Are decimal places limited for big numbers/floats?

Is it related to the IEEE 754 standard (as explained here: Is floating point math broken?)?

And finally - how can I come around this issue?

Community
  • 1
  • 1
ragulka
  • 4,312
  • 7
  • 48
  • 73

1 Answers1

1

Yes, you are seeing the inherent limitations of 64-bit floating point. If you really need more than two decimal places on a number as big as 123,456,789,201,234, you need some sort of extended arithmetic library. This question has some suggestions and discussion.

Community
  • 1
  • 1
Patricia Shanahan
  • 25,849
  • 4
  • 38
  • 75