Approximating $\pi$ in Binary

262 Views Asked by At

I am interested in creating a Java program that generates digits of $\pi$ (in Binary though). To be clear, the number I'm looking for begins: $11.00100100 \dots$

I am unsure of the most efficient way to generate the number. I have looked at the Wikipedia page for this, and I cannot seem to tell which method would be most efficient. I am looking to generating digits of $\pi$ up to perhaps even the billionth digit, so I am looking for a method that is efficient even for such accurate approximations.

Thank you in advance for any help you might give.

2

There are 2 best solutions below

0
On BEST ANSWER

I suggest to play with the algorithms given under the section "Spigot algorithms", esp. the Borwein-Pluffe formula, as it can generate hex digits without memory overhead for previous results.

3
On

Generating billions of digits is probably a job best left to the pros, but you might look at http://en.wikipedia.org/wiki/Approximations_of_%CF%80