Okay so I was at school today and had a fat 2 hour break in between two classes, so I sat down with a calc and started looking at some optimizations that could be brought to some programs. In one of my programs, I noticed the numpad reader routine straight from tibasicdev, which is basically a function that loops around (sorta)
Here is the line from that routine on tibasicdev.

Code:
sub("789  456  123  0.",K-36-5int(.1K),1

And here is the one I came up with, which works and is smaller, and I would assume faster, since the string is smaller...

Code:
sub("7894561230.",K-22-7int(.1K),1

And some screenies to show what I did to end up with this...


Basically, I just modified the fuction so that it would loop around without the need for the two extra spaces in between each set of characters in the string...
Just thought I'd share this with the people in case you would want to use that routine I guess... Oh and I'd like to know if anyone sees any flaw in my routine... You know, in case the other routine was better after all...
This is my result, storing the number in Ans:

Code:
max(0,26-3int(.1K)+10fPart(.1K

It is 10 bytes shorter as yours.
Thet do different things:
Mr womp womp's routine stores the number as a string and yours stores it as an integer.
They are both useful, though Smile.
PT_ wrote:
This is my result, storing the number in Ans:

Code:
max(0,26-3int(.1K)+10fPart(.1K

It is 10 bytes shorter as yours.

Yeah, but you can only have numbers from 0-9, nothing bigger... with the original routine, you can input any number and then just expr(Ans at the end...
  
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