? Stack calculator ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
This website has been moved, please see this post

Stack calculator

Submitted
Updated
Author
SquareFingers
Public Key
NRXJ14MD
Min. Compat.
All
Version
V0.05
Size
18.9KB
Rating
7 votes
Description A stack-based calculator, with macros. In a stack-based calculator, parentheses are not used. Values are added to the stack, then operations are performed on the top element(s) of the stack. For instance, 5+3 becomes: 5 (enter) 3 +. 5 and 3 will disappear from the stack, to be replaced with 8. (2+7)*(10-4) becomes 2 (enter) 7 + 10 (enter) 4 - *. The first operation to be computed is addition, so the first operation you type is +,when you have 2 and 7 at the top of the stack. The second operation to be computed is subtraction, so the second operator you type is -, after putting 10 and 4 on the stack. The last operation to be computed is multiplication, so the last operator you type is *. In this calculator, sequences of operations can be recorded as macros, and played back with a single tap on the touchscreen. Instructions Tap numbers and operations on the touchscreen. The stack is shown on the top screen. Tap the 'HELP' button for more help.
Categories
Keywords
  • calculator
  • stack
  • macro
11 Comment(s) snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements When you load the macros in MACLOAD, you try to load the macro file, and then check RESULT to see if it actually worked. You should instead do: IF CHKFILE(MACFILENAME$) THEN MACFILE$=LOAD("TXT:"+MACFILENAME$,FALSE) ELSE RETURN ENDIF No more ugly load failure prompt when you boot it up without a macro file. It also looks cleaner IMO. SquareFingers SquareFingers Good suggestion, thanks. I'll do that for the next release. snail_ snail_ Power User QSP Contest 1 Contest Participant I participated in the first SmileBASIC Source QSP Contest! Helper Received for being very helpful around SmileBASIC Source Achievements Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements This is really neat. I've always liked RPN calculators; it feels more hands-on with the calculating process (even though it does require more keystrokes and finger gymnastics sometimes.) More like I'm operating a calculating machine than I'm telling a computer to do my math for me. The macro keys are a great addition. What would be nice is the ability to save them to a file; in case someone happens to use this as a dedicated calculator, we wouldn't want them losing their macros every time. Giving them short names would be nice as well, but I don't know how you would work that into the interface. SquareFingers SquareFingers I wondered if saving the macros was a feature I should add... then I thought, nah. Well, V0.05 now saves the macros. hakke hakke RNG Hidden Easter Eggs QSP Contest 2 Contest Participant I participated in the second SmileBASIC Source QSP Contest! Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength I really love how the macros work! Good work! SquareFingers SquareFingers Thanks. I particularly like the roll-a-die macro I describe in the help. I don't know why really, it's not all that clever, but I do like it. hakke hakke RNG Hidden Easter Eggs QSP Contest 2 Contest Participant I participated in the second SmileBASIC Source QSP Contest! Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength I also like how the program is easy to read thanks to the button engine. :) MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies So it's just a reverse-polish notation calculator? Perhaps it could convert from infix to polish notation. Like, you input an infix notation calculation and it spits out the reverse-polish equivalent, and vise versa. SquareFingers SquareFingers So it's ... a reverse-polish notation calculator? Yes, that's what it is. It's not a translator from one language to another (infix to suffix) - that's a rather different type of program. It now has macros, though. If there's an operation you can perform by always tapping the same sequence of keys on the calculator, you can record that sequence, and play it back with a single tap on the touchscreen. randomous randomous Owner Robot Hidden Easter Eggs Second Year My account is over 2 years old Website Drawing I like to draw! Hobbies If you get the time, you should explain how stack-based calculators work (or maybe even explain it in the program somehow). I think it's an excellent programming example. SquareFingers SquareFingers Thank you. V0.02 has built-in help. Not much, but it's something.