Possible? I've heard its not, but I want to clarrify.

Now that I'm back in school I've become more friendly with my calculator (lol) and I've been writing quite a few more programs (of course, 99.9% will never be released as usual Razz ). My latest little program needs this type of conversion.

[EDIT]
Just to clarrify: I found some stuff on Google, but they're long routines and I'd rather not use them in my code... I actually thought about the exact bit of code but I'd rather not do something like that...

Anything simpler?

the code:
Code:
:{0,1→L₁
:{0,N→L₂
:LinReg(ax+b) Y₁
:Equ►String(Y₁,Str1
:sub(Str1,1,length(Str1)-3→Str1
How could this not be possible? How do you think the TI-OS displays numbers on the screen? Very Happy I know the way I'd do it (start dividing by 10 and displaying digits until the dividend is zero), but does anyone have a more efficient method?
It's doable. I've done it by finding the location of the decimal point, then dividing by 10 repeatedly and doing something like
Code:

:str1+sub("0123456789",fpart(Ans))


There's definitely a better way to do it, but it escapes me right now.

Way to reply faster than me, too, Kerm. Smile
The Tari wrote:
It's doable. I've done it by finding the location of the decimal point, then dividing by 10 repeatedly and doing something like
Code:

:str1+sub("0123456789",fpart(Ans))


There's definitely a better way to do it, but it escapes me right now.

Way to reply faster than me, too, Kerm. Smile
Haha. no worries. To expand your code a hair:


Code:

:.1X->X:While(X>0)
:sub("0123456789",fpart(X))+Str1->Str1
:.1(X-fPart(X)->X
:End
Awesome, thanks a lot guys! That helps a ton ^^,

I didin't really think about something like that XD

Will this work with double digits? or only single?
swivelgames wrote:
Awesome, thanks a lot guys! That helps a ton ^^,

I didin't really think about something like that XD

Will this work with double digits? or only single?
In the form I posted above, this will work for integers of arbitrary length. It won't work for floats, though; if you need floats, we'll have to add two pieces to that code.
Okay great, thanks Razz

I'll post up my program when I fit this in and finish the rest of its. Its pretty interesting Smile (and pointless, as usual XD)

[EDIT]
ERR:ARGUMENT
sub("0123456789",fPart(x))+Str1->Str1

Investigating.... XD
KermMartian wrote:

Code:

:.1(X-fPart(X)->X


Its been a while since I've done TI-Basic, but wouldn't this make more sense?


Code:
.1iPart(x->x
Makes sense...

This code works:

Code:
:.1x->x:While X>0
:sub("0123456789",(fPart(x)*10)+1,1)+Str1->Str1
:.1iPart(x->x
:End
swivelgames wrote:
Makes sense...

This code works:

Code:
:.1x->x:While X>0
:sub("0123456789",(fPart(x)*10)+1,1)+Str1->Str1
:.1iPart(x->x
:End


Here's a slightly less-awkward version of that:

Code:
:.1x->x:While X>0
:sub("0123456789",1+10fPart(x),1)+Str1->Str1
:.1iPart(x->x
:End
lol, dur, thanks Laughing
  
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