fork download
  1. <?php
  2.  
  3. $progression=1;
  4. $cpte=10000;
  5. for($i=2;$i<$cpte;$i++){
  6. $progression+=1/$i/$i;
  7. }
  8. $pi=sqrt(6*$progression);
  9. echo "Pi ($cpte loops) : $pi , cste ".M_PI."\n";
  10.  
  11. $progression=1;
  12. $cpte=100000;
  13. for($i=2;$i<$cpte;$i++){
  14. $progression+=1/$i/$i;
  15. }
  16. $pi=sqrt(6*$progression);
  17. echo "Pi ($cpte loops) : $pi , cste ".M_PI."\n";
  18.  
Success #stdin #stdout 0.04s 26072KB
stdin
Standard input is empty
stdout
Pi (10000 loops) : 3.1414971543976 , cste 3.1415926535898
Pi (100000 loops) : 3.141583104231 , cste 3.1415926535898