by ythl · 10y ago · 0 comments
All I can say is wow, that formula slow to converge on pi. The product after 100 million terms is: 3.141592637878503
You can see that 100M terms only gets you 8 decimals of precision.
https://en.wikipedia.org/wiki/Approximations_of_π#Efficient_...
pi/4 = 1 - 1/3 + 1/5 - 1/7 + ...
What makes this expansion particularly painful is that usually Taylor expansion is done around a point where x is small, such that the x^n numerators of subsequent terms get progressively smaller. But in this case the numerator is always 1, so the series depends entirely on the denominator for convergence.
Meanwhile, the denominator doesn't grow by the usual increasing factorial terms common to Taylor series, but grows only linearly. So both effects combined cause this expansion to take a very long time to converge.
What is being tested with 100million function calls?