TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
376 B

--TEST--
π
--FILE--
<?php
function main()
{
ini_set("precision", 17);
$rounds = 1_0000_0000;
$stop = $rounds + 2;
$begin = microtime(true);
$x = 1.0;
$pi = 1.0;
for ($i = 2; $i <= $stop; $i++) {
$x = -1.0 + 2.0 * ($i & 0x1);
$pi += $x / (2 * $i - 1);
}
$pi *= 4.0;
print $pi . "\n";
}
?>
--EXPECT--
3.141592643589326