php - Power big float numbers (100.33^360) -


i have problem:

pow(100.33, 360); // return inf 

i use gmp, not float number:

gmp_strval(gmp_pow('2', 3)); //return 8 gmp_strval(gmp_pow('2.0', 3)); //return 0 

please :) how it?

from php gmp documentation page:

these functions allow work arbitrary-length integers using gnu mp library.

in other words, no floating point allowed. gmp can floating point appears php interface doesn't use full power.

you can use bcpow functionality like:

$num = bcpow('100.33', '360', 20); echo $num; 

and outputs:

3274103534834396431867559103093187830103180578316133866868 8735096209772372540787863291005903612118038812972585250990 9184783128175191070195558359762317865469719418788175465726 2260403727769361000933644502616255136475528818978181028888 7900899387124705985519483201689097535257257471686279645479 0293787644875616262913286836073610372960697383687245477891 3127091993585718764278131719726387787145646698001143323773 8827166195539744295014989026208988133960971242873367417385 5744373185506374857530249495974084141129611541831378797038 9257147348718093640732700784857982966810730374711336160716 5240002574688357771367833219551029582525497843733924244263 5089812833806492039068418216603999851813542524325083024650 6447037300606418104334363.93719644178064144117 

Comments