million_digits_of_pi is a minimal C++ program that can compute
The focus of this project is conciseness and readability, not optimisation. So
this code is very slow. Nevertheless, it can compute
This program will compute
These complexities are exact since the FFT uses a fixed number of digits per point. However, the program will fail above 800 million digits due to round off error.
The Schönhage–Strassen
algorithm is an asymptotically fast multiplication algorithm for large integers.
It works by recursively applying number-theoretic transforms
(a form of fast Fourier transform) over the integers modulo
The algorithm is based on the negated Heegner number
Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valued function.
In mathematics, binary splitting is a technique for speeding up numerical evaluation of many types of series with rational terms. In particular, it can be used to evaluate hypergeometric series at rational points.
Given a series
where
Returns a very good approximation of
- I <3 pull requests and bug reports!
- Don't hesitate to tell me my code-fu sucks, but please tell me why.
- Feel free to fork the project and try out your own optimisations.
Million Digits of Pi is licensed under the MIT License.
Copyright (c) 2023 Samarth Kulshrestha.