Reputation: 14119
I need to raise 8 to the power of 17 in PHP. I have checked this to be 2251799813685248 on my PC's calculator, but both the pow()
and bcpowmod()
functions seem to overflow; pow()
goes into scientific notation, and echoing the results from bcpowmod()
, even with a high third parameter gives me a blank screen. Is there any other way I could perform this calculation?
Upvotes: 1
Views: 641
Reputation: 132011
Use pow()
. The "scientific notation" you are talking about is just a notation and you can format it later.
echo number_format(pow(8,17), 0, '', '');
Beside this I couldn't reproduce the "scientific-notation"-behaviour for the given values
http://codepad.viper-7.com/AwM3CS (Uses bigger values to enforce the scientific notation)
Upvotes: 1