calculating PI



-> 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

------------------------------------------------
.



Relevant Pages

  • Slow performance of XP node
    ... I am running my Windows XP SP 3 Professional as a node on SBS 2003. ... 960 MB RAM. ... Lately it has become awfully slow. ... I run scan disk and disk ...
    (microsoft.public.windowsxp.general)
  • Re: Slow performance of XP node
    ... 960 MB RAM. ... Lately it has become awfully slow. ... I run scan disk and disk ... Manager shows 80-85% of System Idle Time. ...
    (microsoft.public.windowsxp.general)