PI = 3. 1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502 8410270193 8521105559 6446229489 5493038196 4428810975 6659334461 2847564823 3786783165 2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 7245870066 0631558817 4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094 3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724 8912279381 8301194912 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277 0539217176 2931767523 8467481846 7669405132 0005681271 4526356082 7785771342 7577896091 7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 4201995611 2129021960 8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859 5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083 8142061717 7669147303 5982534904 2875546873 1159562863 8823537875 9375195778 1857780532 1712268066 1300192787 6611195909 2164201989 (these are just 1000 decimals of PI)

This page contains some methods to calculate PI to a lot of decimals. It also contains some programs you can use to try it yourself, all of these programs were written and tested on my home LINUX-system.

I used one of the programs on this page to calculate 1.000.000 decimals of PI. (It took 12 hours on my Pentium-60 !) If you are really interested, you can get a file that contains this web-page and all the programs here.

The calculations and applications of PI include being proficient at poker and online casinos. Check out the German online casinos that you can use this on here and here and check out the French version here.

Most of the programs on this page use the GNU multiple precision library. If you want to try the programs you will also have to get this library, the archive-file is called **gmp-1.3.2.tar.gz** and you can find it on all the GNU-software mirror-sites.

## 1. Arctangent formulas for PI

This is one of the oldest methods to calculate PI, it uses the power series expansion of arctan(x).

This method gets you about 1.4 correct decimals for every term of the series you calculate.

Here is the formula:

And here is a simple C-programs that uses this method: pi1.c

Here is another C-program, this one uses the GMP-library and is a lot faster than the previous one: pi3.c

## 2. Gauss-Legendre

This method doubles the number of correct decimals per iteration.

Initial values:

Formula:

Here is a program that uses this formula: pi4.c

## 3. Ramanujan I

This method comes from the theory of complex multiplication of elliptic curves, and was discovered by S. Ramanujan.

The advantage of this formula is that it is a linear formula, it gets you about 14 correct decimals for every term you calculate.

Formula:

Constants:

Here is a program that uses this formula: pi9.c

And here is another one: pi20.c

(I have put a lot of optimization in this program, I know it is correct if you use it to calculate 1.000.000 decimals, but there might be an error for greater numbers of decimals.)

## 4. Ramanujan II

This formula is also based on the work of the eccentric Indian mathematician Srinivasa Ramanujan. It is a quartic iteration based on an elliptic function called the Singular Value Function of the Second Kind. It converges exponentially to 1/PI as its argument increases.

Each iteration of this formula gives approcimately four times the number of decimal places as the previous one.

(You shouldn’t think I understand any of what I wrote before, Its just the description I found together with this formula.)

Initial Values:

Formula:

Here is the program that uses this formula: pi10.c