section_path: Calculation/Arithmetic–geometric mean approximation
section_name: Arithmetic–geometric mean approximation
paragraph_text: Arithmetic–geometric mean approximation
  
  The arithmetic–geometric mean yields high-precision approximations of the natural logarithm. Sasaki and Kanada showed in 1982 that it was particularly fast for precisions between 400 and 1000 decimal places, while Taylor series methods were typically faster when less precision was needed. In their work ln(x) is approximated to a precision of 2 (or p precise bits) by the following formula (due to Carl Friedrich Gauss):
  
  ln (x) ≈ π 2 M (1, 2 2 − m / x) − m ln (2). {\displaystyle \ln(x)\approx {\frac {\pi }{2\,\mathrm {M} \!\left(1,2^{2-m}/x\right)}}-m\ln(2).}
  
  Here M(x, y) denotes the arithmetic–geometric mean of x and y. It is obtained by repeatedly calculating the average (x + y)/2 (arithmetic mean) and x y {\textstyle {\sqrt {xy}}} (geometric mean) of x and y then let those two numbers become the next x and y. The two numbers quickly converge to a common limit which is the value of M(x, y). m is chosen such that
  
  x 2 m > 2 p / 2. {\displaystyle x\,2^{m}>2^{p/2}.\,}
  
  to ensure the required precision. A larger m makes the M(x, y) calculation take more steps (the initial x and y are farther apart so it takes more steps to converge) but gives more precision. The constants π and ln(2) can be calculated with quickly converging series.