0

I'm trying to calculate Math.pow(2,1000) and I am getting Result : "1.0715086071862673e+301"

If I try Math.pow(2,10000), then I get Result : "Infinity".

Can anyone help me to solve this using javascript?

Bojangles
  • 99,427
  • 50
  • 170
  • 208
Darkpiece
  • 111
  • 5

2 Answers2

2

You can also try https://github.com/peterolson/BigInteger.js for big number calculation.

Prabhuram
  • 1,268
  • 9
  • 15
0

You can't calculate such large numbers solely with JavaScript, you will probably need to use a library for that.

Please take a look at https://github.com/jtobey/javascript-bignum or http://jsfromhell.com/classes/bignumber

Dropout
  • 13,653
  • 10
  • 56
  • 109