Error in Javascript parseint value with very large number

Asked

Viewed 33 times

0

When converting a number into decimal string format to the numeric value, I get the wrong number:

parseInt("36428971654192132")
// 36428971654192130

1 answer

2

According to Javascript.info, the guy number cannot correctly represent integers larger than 2^53-1, or 9,007,199,254,740,991.

Comparing:

  • 9007199254740991
  • 36428971654192132

Try to use Bigint:

BigInt("36428971654192132");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.