Re: calculating PI
- From: winston19842005 <bjjlyates@xxxxxxxxxxxxxxxxxxx>
- Date: Sun, 28 Sep 2008 12:40:59 -0400
On 9/28/08 11:50 AM, in article 1222617002.877.1222614035@xxxxxxxxxx, "David
Williams" <david.williams@xxxxxxxxxx> wrote:
-> I always liked the Montecarlo method for determining PI!Wow...
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
------------------------------------------------
I ran this in TI-99 Extended Basic (all floats, a form of base-100 BCD).
When I assigned the expression to PIE at the end and printed PI-PIE, got 0
(with no ".").
First, PI is of course the constant for PI.
Second, before anyone says that it is really PI-PI because of 2-digit
variable names, TI has 15-significant characters in the variable name.
Third, a "." after a number when printed means the number is not exact, but
is outside the range of normal printing rules (thus requiring a PRINT
USING).
I'm trying to get the source-code to a fellow TI'ers program that calculates
PI to 5200 decimal places.
Recent post:
"Hi.
I'm pleased to announce that our TI 99/4A computer has calculated the
first 5200 decimals of Pi in 184 hours of continuous operation using
my PICALC XB program! I believe this is a record among all classic 8
bit computers (by far)."
I'll follow up with the source when I can get it converted... althought I
highly doubt the record... speed is not one of the 99's qualities.
.
- Follow-Ups:
- Re: calculating PI
- From: winston19842005@xxxxxxxxx
- Re: calculating PI
- References:
- calculating PI
- From: David Williams
- calculating PI
- Prev by Date: calculating PI
- Next by Date: Re: another?
- Previous by thread: calculating PI
- Next by thread: Re: calculating PI
- Index(es):
Relevant Pages
|