tags:

views:

185

answers:

4

how to calculate value of pi in php till 100000 decimal numbers.. or may be more

A: 

Calculating PI in php?

Why calculate when we already have the M_PI constant?

M_PI contains the value 3.14159265358979323846.

10000 decimal places for PI is quite a number.

See: http://www.php.net/manual/en/math.constants.php

thephpdeveloper
Apparently you can set the precision of `pi()`/`M_PI` in php.ini. Not sure if it goes to 11^H 100K though. :) http://php.net/manual/en/function.pi.php
deceze
Too bad, apparently it only goes to 48, on my system at least. :)
deceze
thanks to deceze for working that out!
thephpdeveloper
calculating pi is a useful cpu benchmark.
Rob
+1  A: 

Numerically approximating pi.

Austin Kelley Way
+2  A: 

See here for an algorithm in PHP: http://mgccl.com/2007/01/22/php-calculate-pi-revisited

Konamiman
+1  A: 
  1. Find a website with Pi to 100000 places (okay, here)
  2. Copy-paste into PHP as a string.
  3. Echo string.
DisgruntledGoat
oh this is not calculating?
thephpdeveloper
I was just being facetious. I don't get why you would ever want to calculate pi in PHP.
DisgruntledGoat