
That means it can calculate the 10th digit of PI (around 87 billion cycles) in about an hour. The final program runs, by glancing at it (that means a very unreliable measurement), at an approximated rate of 30 million cycles per second in my computer. The program runs until piCycles reaches the maximum value a long long int can get OR the End key is pressed. To prevent concurrency problems, mutexes are used to prevent the threads from accessing Pi and other program shared variables at the same time. It starts by first running two background threads which execute two functions that do all the job: piLoop(), for calculating the series and displayLoop(), for refreshing the screen and displaying the actual calculated Pi.

I wrote this console application with a simple goal: Approximate as fast as possible as many digits of Pi the program can until it reaches the maximum number the cycle counter can achieve(without starting to commit calculation errors with the series formula) OR the program is stopped. It was interesting so I decided to try it too. Yesterday I saw a CodeTrain video in where Daniel Shiffman tried to approximate Pi using the Leibniz series.
