3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xpnd($scientific, $precision){ # expand from scientific notation if(is_int($scientific)){ #don't convert integers return $scientific; } return sprintf("%.".$precision."F", $scientific); } function exp2int($exp) { list($mantissa, $exponent) = spliti("e", $exp); if($exponent=='') return $exp; list($int, $dec) = split("\.", $mantissa); bcscale (abs($exponent-strlen($dec))); return bcmul($mantissa, bcpow("10", $exponent)); } echo "1 - ".bcdiv(0.0000967, 2, 10)."\n"; echo "2 - ".(40075036/86164.098903691)."\n"; echo "3 - ".bcdiv(xpnd(0.0000967, 10), 2, 10)."\n"; echo exp2int("1.5");

preferences:
59.42 ms | 402 KiB | 5 Q