4 ms·
You can save yourself some trouble with a bit of math. Continued fractions are known to provide the best approximations under a reasonable definition of "best":
by civilized 4y ago
You can save yourself some trouble with a bit of math. Continued fractions are known to provide the best approximations under a reasonable definition of "best": https://blogs.scientificamerican.com/roots-of-unity/what-8217-s-so-great-about-continued-fractions/ https://blogs.scientificamerican.com/roots-of-unity/what-821...
Computing the continued fraction for pi actually presents some technical obstacles though - it has to be done numerically, since there's no known pattern to the sequence, and to do that, it seems like you need to compute higher and higher-precision numerical approximations to pi in order to accurately compute higher terms in the continued fraction expansion.
Turns out there is another way:
https://math.stackexchange.com/a/720082/ https://math.stackexchange.com/a/720082/