fork download
  1. <?php
  2.  
  3. $p=0;
  4. $i = 0;
  5. $a = 1;
  6.  
  7. while($i!=10000){
  8. $p=$p+(1/$a);
  9. $a=$a+2;
  10. $p=$p-(1/$a);
  11. $a=$a+2;
  12. $i++;
  13. }
  14. echo sprintf("%.64f\n",$p*4);
  15. echo sprintf("%.8f\n",$p*4);
  16. echo sprintf("%.6f\n",$p*4);
  17.  
Success #stdin #stdout #stderr 0.02s 52432KB
stdin
Standard input is empty
stdout
3.14154265358982476286087148764636367559432983398437500
3.14154265
3.141543
stderr
PHP Notice:  sprintf(): Requested precision of 64 digits was truncated to PHP maximum of 53 digits in /home/2wgqxT/prog.php on line 14