Mega Code Archive

 
Categories / Php / Math
 

Doing math with the bcmath extension

<? $a = bcmul(3.5, bcpow(10, 406)); $b = bcmul(2.8, bcpow(10, 406)); $a_squared = bcpow($a, 2); $b_squared = bcpow($b, 2); $hypotenuse = bcsqrt(bcadd($a_squared, $b_squared)); print $hypotenuse; ?>