2 days ago
- The article explores methods to compute π, shifting from historical manual calculations to modern algorithms like Chudnovsky.
- John Machin's formula was a key method for centuries, allowing William Shanks to compute π to 707 digits (with errors) in the 1800s.
- Infinite series, such as arcsin expansions, provide a mathematical approach but converge very slowly for π calculations.
- The Chudnovsky algorithm, discovered in 1987, is highly efficient, computing over 14 digits of π per iteration.
- Arbitrary precision arithmetic, using GMP, enables computing π to a chosen number of bits, overcoming limits of standard floating-point types.
- The Chudnovsky formula, involving factorials and powers, is implemented in a C program using GMP for high-precision results.
- The summation in Chudnovsky is embarrassingly parallel, allowing multi-core acceleration with tools like OpenMP.
- Precision in bits is calculated with bits_per_digit ≈ 3.32193 to ensure sufficient bits for desired decimal digits.