I have a TI 84 Plus SE with the 2.43 OS. I was trying to do some specific output to the screen and realized it didn’t have the toString command which is in the newer OS. I don’t play around with the calculator that much to download the new OS. Just for kicks I wrote something that works. Since a lot of people here like to optimize code, I thought I would post it and see if anyone wants to optimize it or make it better. When the code is run, at the ? prompt, key in some value like .5 or √37 or sin(24). The result will be displayed on the same line as “Z=“ instead of the next line. It also prints out the full 14 digits of the answer if you display it on a line by itself. I just tried and realized that it doesn’t handle negative numbers. If a number is less than 1, it will print a leading 0 before the decimal point. The sub command can be use to limit the number of digits displayed.


Code:

Input V
“0123456789”->Str1
“0”->Str2
iPart(V)->I
fPart(v)->F

While I>0
fPart(I/10)->J
iPart(I/10)->I
sub(Str1,J*10+1,1)->Str3
If Str2=“0”
Then
Str3->Str2
Else
Str3+Str2->Str2
End
End

If F ≠ 0
Then
Str2+”.”->Str2
End

While F*10>0
iPart(F*10)->G
Str2+sub(Str1,G+1)->Str2
fPart(F*10)->F
End

Disp “Z=“+Str2
Pssst... 2.53MP for the TI-84 Plus doesn't have toString( built in.

But, cool idea.
ShinyGardevoir wrote:
Pssst... 2.53MP for the TI-84 Plus doesn't have toString( built in.

Dude, that's literally why he made this program.

Nice work though dave1707! I'm like that someone took the initiative to do this in basic. Any thoughts on how you might improve it?
Here’s the above code to handle negative numbers.


Code:

Input V
0->S
If V<0
Then
1->S
V*-1->V
End
“0123456789”->Str1
“0”->Str2
iPart(V)->I
fPart(v)->F

While I>0
fPart(I/10)->J
iPart(I/10)->I
sub(Str1,J*10+1,1)->Str3
If Str2=“0”
Then
Str3->Str2
Else
Str3+Str2->Str2
End
End

If F not= 0
Then
Str2+”.”->Str2
End

While F*10>0
iPart(F*10)->G
Str2+sub(Str1,G+1)->Str2
fPart(F*10)->F
End

If S=1
Then
“-“+Str2->Str2
End
Disp “Z=“+Str2
I like that you DIYed it, but here you go.
No need to reinvent the wheel Wink
mr womp womp wrote:
I like that you DIYed it, but here you go.
No need to reinvent the wheel Wink

More like here you go.
I saw both of those. I tried the basic version and it works great. I don’t mess with asm, so I didn’t try that one. I like to try writing things myself just for something to do. It’s not the greatest, but it worked.
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement