Gauss-Legendre algorithm

HomePage | Recent changes | View source | Discuss this page | Page history | Log in |

Printable version | Disclaimers | Privacy policy

The algorithm used as a basis to calculate Pi to 206,158,430,000 decimal digits on September 18 to 20 1999, along with Borweins Quartically Convergent Algorithm. Based on the individual work of Johann Gauss (1777-1855) and Adrien-Marie Legendre (1752-1833) combined with modern algorithms for multiplication and square roots

1. Initial value setting;

a = 1 b = 1 / SqRt(2) t = 1/4 x = 1


2. Repeat the following statements until the difference of a and b is within the desired accuracy;

y = a
a = (a+b) / 2
b = SqRt(b*y)
t = t - x * (y-a)^2
x = 2 * x

3. Pi is approximated with a, b and t as;

Pi = ((a+b)^2) / (4*t)


The algorithm has second order convergent nature.