3

So if I do 712569312664357328695151392 + 8100824045303269669937 I want the result to be:

712577413488402631964821329

But instead I have

7.125774134884027e+26

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Gini
  • 121
  • 1
  • 6
  • Please have a look here: http://stackoverflow.com/questions/16742578/bigdecimal-in-javascript – Nina Scholz Nov 10 '15 at 21:58
  • Possible duplicate of [How to avoid scientific notation for large numbers in JavaScript?](http://stackoverflow.com/questions/1685680/how-to-avoid-scientific-notation-for-large-numbers-in-javascript) – Josef Engelfrost Nov 10 '15 at 23:45

1 Answers1

2
let a = 712569312664357328695151392;
let b = 8100824045303269669937;

(BigInt(a) + BigInt(b)).toString() will give you your expected result.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
DhanteyUD
  • 71
  • 3