Friday, August 6, 2010

testing


  • The algorithm described above has an O(n2) duration. So 10 times as many decimal places will take about 100 times as long. My 7,000 MIPs PC took about 15 hours to calculate the first 1,000,000 decimal places of pi. That works out at about 380 million million instructions in total.
  • To get 1,000,000 decimal places, each multi-length number is implemented as an array of 166685 integers, using a base of 1,000,000 so that each integer gives us 6 significant digits. This actually gives us 1,000,104 decimal places, but the last few might be incorrect because of the infinite number of terms of the Maclaurin series that we have to throw away. Comparison with this shows that the last three decimal places are wrong, so we have actually got pi correct to 1,000,101 decimal places.
  • The first 1,000,000 decimal places of pi were first calculated in 1973.
  • The 19th century English mathematician William Shanks spent over 15 years calculating the first 707 places of pi using Machin's formula. He published his results in 1873. In 1944 it was found that he had made a mistake in the 528th place, and all the following digits were wrong. By changing to #define NDecimalPlaces (1000), you can now achieve in a fraction of a second more than William Shanks failed to achieve in 15 years.