Brent Salamin algorithm pi calculator

The Brent Salamin algorithm can be used to calculate pi to any number of decimal places (Wikipedia). Each iteration of the algorithm doubles the number of correct decimal places. Seven iterations is sufficient to get 90 correct decimal places. Here you can enter n, the number of iterations, and see how accurate the result is for various values. [The estimate is shown to 90 decimal places, even when they are not all correct.]

Enter an integer n (1 to 10):

Warning: bcdiv() [function.bcdiv]: Division by zero in /home/jakebake/public_html/maths/bs.php on line 47

The estimate for pi is: