views:

139

answers:

2

Using PHP I want to do millions of 2^n exponentiation but so far I only got up to n^1023 before PHP printed INF.

Any ideas?

+3  A: 

You can use the BC Math functions:

  $num = bcpow(2, 1000000); // Takes a few seconds to run!
Greg
I'll experiment with both BC Math and GMP
Chad
+4  A: 

As Greg said, BC Math is fine, but if you really need efficiency, try GMP instead.

Seb