1

enter image description here

Why is this happening to me?? I multiply the same numbers in python and chrome's JS console but it seems as if JS has forgotten how to calculate.

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
Shaurya Gupta
  • 327
  • 3
  • 14

1 Answers1

7

Python integer numbers are long ints.

JavaScript numbers are (double) floating points. The largest accurate JavaScript integer value is 2^53:

9007199254740992

Your number exceeds this value. If you need to handle integers accurately in JavaScript over the floating point threshold you need to some big number library.

Community
  • 1
  • 1
Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435