This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
Jedd
1980 Pong World Champion


Elite


Joined: 18 Nov 2003
Posts: 823

Posted: 01 Dec 2003 11:01:04 pm    Post subject:

I made a program to solve for pi using the method:

pi / 4 = 1 - 1/3 + 1/5 - 1/7 + 1/9.....

and it only lets you see 9 decimal places. Does anyone know of a way to let the variable contain more than 9 decimal places? I know in C there's something like "float" but im not to good with computer programming. btw I wouldnt reccomend making this program; its best uses are battery waster and ram clearer.
Back to top
Fr0sty


Member


Joined: 27 Nov 2003
Posts: 202

Posted: 01 Dec 2003 11:16:18 pm    Post subject:

Uhh... you can try multiplying out your number by like 10000000000000000 then tell them that the decimal is supposed to be after the first digit (in this case, a 3)
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 01 Dec 2003 11:53:10 pm    Post subject:

Yes,

you use that method, but you write your own calculation routinees using strings. It is slower and more difficult, but you can get more accuracy.
Back to top
Jedd
1980 Pong World Champion


Elite


Joined: 18 Nov 2003
Posts: 823

Posted: 02 Dec 2003 01:04:19 am    Post subject:

How would i do that with strings? here's the program as it is now...


ClrHome
0->P
-1->B
For(A,1,1000001,2
-B->B
P+B(1/A0->P
Output(4,1,P4
End


Last edited by Guest on 02 Dec 2003 09:05:20 am; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 02 Dec 2003 05:30:46 pm    Post subject:

You could use lists to get up to 999 digits. That would be faster than using strings.

Code:
{0 -> L1
999 -> dim(L1
-1 -> B
For(A,1,1000001,2
-B -> B
prgmINVERSE
L1 + BL2 -> L1
For(I,999,2,-1
L1(I-1)-(L1(I)<0)+(L1(I)>9 -> L1(I-1
L1(I)+10((L1(I)<0)-(L1(I)>9 -> L1(I
End
End
-------------------------------------------
prgmINVERSE
{int(10/A -> L2
AfPart(10/A -> R
{1,R -> L3
2 -> I
Repeat 1-sum(R=L3) or I=999 or not(R
int(10R/A -> L2(I
I+1 -> I
AfPart(10R/A -> R
R -> L3(I
End
If R:Then
dim(L3 -> R
DelVar L3
seq(L2(RfPart(I/R)),I,1,999 -> L2
End

I think this will work.


Last edited by Guest on 03 Dec 2003 04:43:23 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement