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.
 
 

22 lines
440 B

<?php
use native_types;
function main()
{
ini_set("precision", 17);
$rounds = (int) file_get_contents("./rounds.txt", true);
$stop = $rounds + 2;
var_dump($stop);
$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 . "\ntime: " . (microtime(true) - $begin) . "\n";
}