calculating PI
- From: david.williams@xxxxxxxxxx (David Williams)
- Date: Sun, 28 Sep 2008 10:50:02 -0500
-> I always liked the Montecarlo method for determining PI!
It's awfully slow, though!
I came across the following little thing on an old disk. It calculates
PI to amazing precision very quickly. I think someone gave it to me.
Maybe I understood it then, but not now. Can anyone tell me, please?
dow
-----------------------------------------
' PI calculator
DEFINT C, Z
DEFLNG D
DEFDBL P-T
P = 0
Q = 0
R = 0
S = 0
T = 0
D = 1
Z = 2
CLS
PRINT 4# * ATN(1)
FOR C = 1 TO 1000
T = S
S = R
R = Q
Q = P
P = P + 1 / D
Z = -Z
D = Z - D
NEXT
PRINT (P + 4 * (Q + S) + 6 * R + T) / 4
END
------------------------------------------------
.
- Follow-Ups:
- Re: calculating PI
- From: Charles Richmond
- Re: calculating PI
- From: news@xxxxxxxxxxxxxxx
- Re: calculating PI
- From: winston19842005
- Re: calculating PI
- Prev by Date: Re: another?
- Next by Date: Re: calculating PI
- Previous by thread: Social simulation
- Next by thread: Re: calculating PI
- Index(es):
Relevant Pages
|