#
*Java Number Cruncher*

Program 13-3

##
Computing the Digits of *pi*

This program demonstrates arbitrary-precision arithmetic by computing
the digits of *pi* using the Borwein iteration algorithm first
published by Jonathan Borwein and Peter Borwein in 1985:

Iteration #1 produces 8 correct decimal digits, iteration #2 produces 41 digits, iteration #3 produces 171 digits, iteration #4 produces 694 digits, and each subsequent iteration increases the number of correct digits by more than a factor of four. Because it needs to test for convergence, the program will do one more iteration than necessary.

This program computes the digits of *pi* in several phases, and
each phase can consist of several tasks. It displays the current phase
and task, the elapsed time hh:mm:ss of the previous phase, and the total
elapsed time hh:mm:ss. (The total elapsed time does not include the time
to display the digits of *pi*).

To ensure the accuracy of the last digits, the program computes with a scale equal to 0.5% more than the specified number of decimal digits.

## To run the demo:

- Enter the number of decimal digits of
*pi*to compute. - Press the
**Run**button. - Press the
**Stop**button at any time to stop the computation.