Gauss-Legendre algorithm
The Gauss-Legendre algorithman algorithmcomputedigitsPi.The methodbased onindividual workCarl Friedrich Gauss (1777 - 1855)Adrien-Marie Legendre (1752-1833) combinedmodern algorithmsmultiplicationsquare roots. It repeatedly replaces two numbers by their arithmeticgeometric mean,orderapproximate their arithmetic-geometric mean.
The version presented belowalso known asSalamin-Brent algorithm;was independently discovered1976 by Eugene SalaminRichard Brent. It was usedcomputefirst 206,158,430,000 decimal digitsPi on September 1820, 1999, andresults were checkedBorwein's algorithm.
1. Initial value setting;
- a = 1, b = 1 / √22, t = 1/4, p = 1
- x = (a+b) / 2
- y = √(a*b)
- t = t - p * (a-x)2
- a = x
- b = y
- p = 2 * p
- Pi ≈ (a+b)2 / (4*t)
