How to expaind the Pi number with n decimal digits?

From: [email protected] (niboca...)

I would like to know how to calculate, how to compute
the pi number with n decimal digits, say 1000 places.

I intent to follow Machin formula (or another).

pi = 16 arctan (1/5) - 4 arctan (1/239)
where arctan (x) = x - x^3/3 + x^5/5 - x^7/7 + ...

The common known algorithm is:

a = 16 / 5
b = 4 / 239
pi = a - b
sign = -1
FOR n = 3 TO ... STEP 2
a = a / 25
b = b / 57121
pi = pi + sign * (a - b) / n
sign = -sign
NEXT n

We know the computer does not support this amount of
numbers, and this is exactly the question: how to make
the expansion of the decimal digits. I would like
to know an easy method, step-by-step, for beginner
user (not for advanced user). Preferentially with a
simple text.

Can anyone here help me?

Thanks.
Nilton

Share |