PHP integer exponentiation (super large numbers)
Using PHP I want开发者_如何学Go to do millions of 2^n exponentiation but so far I only got up to n^1023 before PHP printed INF.
Any ideas?
As Greg said, BC Math is fine, but if you really need efficiency, try GMP instead.
You can use the BC Math functions:
$num = bcpow(2, 1000000); // Takes a few seconds to run!
精彩评论