Author |
Message |
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 01 Apr 2004 01:38:05 am Post subject: |
|
|
...Continued from Ti Basic Pi Calculator: 800 digits of PI, no joke (Censored by Admin).
I'll try porting over the PI routine this weekend. With any luck I should be a able to avoid whatever problems VTI was having with the present versions. Just curious: did the original author ever suggest it might be possible to calculate more than 800 digits? (I'm guessing the limit is 800 due to limited screen space). |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 01 Apr 2004 06:11:25 am Post subject: |
|
|
Wouldn't censoring involve deleting the topic, as opposed to closing it?
Will you post the converted source here? |
|
Back to top |
|
|
DigiTan Unregistered HyperCam 2
Super Elite (Last Title)
Joined: 10 Nov 2003 Posts: 4468
|
Posted: 01 Apr 2004 12:13:09 pm Post subject: |
|
|
Here's the PI Calc code. (Written by Rudy Harjanto. Converted by Awesome1)...
Code: ClrHome
Delvar L1
Delvar L2
0->Z
{0->L2
Disp "л Calculator
Input 'Digits: ",N
int((10*N)/3->L
For(B,1,L
1->L1(B
End
-2->C
Output(5,7,"percent
For(J,1,L
2->L1(J
ENd
0->A
0->P
FOr(J,1,N
0->Q
For(I,L,1,-1
10*L1(I)+Q*I->X
X-(2*I-1)int(X\(2*I-1)->L1(I
int(X/(2*I-1)->Q
End
Z=1->Z
Output(5,4,iPart(100(z-1)/N
Q-10int(Q/10->L1(1
int(Q/10->Q
If Q=)
Then
A=1->A
Else
If Q=10
Then
C+1->C
augment(L2,{0}->L2
End
0->P
0->A
Else
C+1->C
augment(L2,{P}->L2
Q->P
If A(not equal to)0
Then
For(K,1,A
C+1->C
augment(L2,{9}->L2
End
0->A
End
End
End
End
C+1->C
augment(L2,{P}->L2
Clrhome
ClrDraw
AxesOff
For(C,1,N+2
Text(6int(C/23),(C*4)-92int((C*4)/92),L2(C
End
Text(0,0,"л=3.
The commands look like they can port over to 82 BASIC pretty well. Except for the maybe Delvar lines (Can't find it in the library). From the looks of it they're non-essential through. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 01 Apr 2004 02:31:21 pm Post subject: |
|
|
The DelVar L2 is unnecessary since {0 is stored to L2 anyway. The DelVar L1 can also be replaced with {0 -> L1 or 0 -> dim(L1.
Actually, the whole thing could be rather significantly optimised. And what's the "Q=)" about? Is this some weird emoticon (something along the lines of "smiling sailor")? |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 01 Apr 2004 03:05:25 pm Post subject: |
|
|
That smiling sailor would give a syntax error, I'm sure.
And what's with this?
For(B,1,L
1->L1(B
End
-2->C
Output(5,7,"percent
For(J,1,L
2->L1(J
ENd
Why not just Fill(2,L1) instead of one obviously useless loop and a better-but-could-be-replaced-with-a-single-command loop? |
|
Back to top |
|
|
Awesome1
Advanced Member
Joined: 28 Jan 2004 Posts: 269
|
Posted: 01 Apr 2004 03:38:11 pm Post subject: |
|
|
hmm, not sure. I'd like to see someone advanced optimise this. I'd try it myself but i have no clue what the functions do in it. I just posted it for people to attempt to optimise, port, and just to look at the functions. |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 01 Apr 2004 04:20:37 pm Post subject: |
|
|
Code: ClrHome
Disp "л Calculator
Input 'Digits: ",N
int((10*N)/3->L
Ans -> dim(L1
Ans -> dim(L2
Fill(L1,1
-2->C
Output(5,7,"percent
Fill(L2,2
DelVar ADelvar PDelvar ZFor(J,1,N
DelVar Q
For(I,L,1,-1
10L1(I)+QI->X
X-(2I-1)int(X\(2I-1->L1(I
int(X/(2I-1->Q
End
Z+1->Z (?)
Output(5,4,iPart(100/N(z-1
10fpart(Q/10->L1(1
.1(Q-Ans->Q
If Q=)
Then
A+1->A (?)
Else
If Q=10
Then
C+1->C
augment(L2,{0->L2
End
DelVar PDelVar AElse
C+1->C
augment(L2,{P->L2
Q->P
If A
Then
For(K,1,A
C+1->C
augment(L2,{9->L2
End
Delvar A
End
End
End
End
C+1->C
augment(L2,{P->L2
Clrhome
ClrDraw
AxesOff
For(C,1,N+2
Text(6int(C/23),(C*4)-92int((C*4)/92),L2(C
End
Text(0,0,"л=3.
I don't guarantee this works, but if it doesn't, it's not my fault. |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 01 Apr 2004 04:54:23 pm Post subject: |
|
|
DigiTan,
I closed the topic, and it will stay closed! |
|
Back to top |
|
|
|