0

For example,
var a = parseFloat("123456789012345678.778") gives the output as 123456789012345680

  • This is Interesting also for me. Maybe this thread might help: https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript – Harun Yilmaz Apr 13 '20 at 10:33

1 Answers1

0

parseFloat converts BigInt syntax to Numbers, losing precision. This happens because the trailing n character is discarded.

You can read more at:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat

Abhishek Jain
  • 356
  • 1
  • 3
  • 15