Write a routine in double or long double precision to implement the following algorithm for computing π.
Which converges faster, f or g? How accurate are the final values? Also compare with the double- or long-double precision computation of 4.0 arctan(1.0).
Hint: The value of π correct to 36 digits is
3.14159 26535 89793 23846 26433 83279 50288
Note: A new formula for computing π was discovered in the early 1970s. This algorithm is based on that formula, which is a direct consequence of a method developed by Gauss for calculating elliptic integrals and of Legendre’s elliptic integral relation, both known for over 150 years! The error analysis shows that rapid convergence occurs in the computation of π, and the number of significant digits doubles after each step. (The interested reader should consult Brent [1976], Borwein and Borwein [1987], and Salamin [1976].)
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.