Jump to content

Recommended Posts

Reverse Polish Notation (RPN) is a math notation in which each operator follows its two operands. I own an HP 48G calculator which uses RPN, and when I tried to use the windows calculator I had so much trouble that I wrote my own calculator. Basically, it has a stack of numbers; any time an operator is pressed, that operation is carried out immediately on the two items on the bottom of the stack, or the stack and the input if there is anything in the input. This method reduces the requirements for parenthesis and makes calculating equations/functions relatively easy: instead of

(sqrt(5+8))/(8*9)

you would enter

5 ENTER 8 + SQRT 8 ENTER 9 * /

Practical implications

Suggestions/advice/criticisms are greatly appreciated!

calc2.au3

Edited by darthwhatever

[font=arial, sans-serif]How is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain. Remember when I took that home winemaking course, and I forgot how to drive?[/font][font=arial, sans-serif]<div>This is how you annoy a web developer.</span>[/font]

Link to comment
Share on other sites

Whoops. I was going to add the option for the user to add functions, but decided that was too much of a pain. Attached file is updated.

[font=arial, sans-serif]How is education supposed to make me feel smarter? Besides, every time I learn something new, it pushes some old stuff out of my brain. Remember when I took that home winemaking course, and I forgot how to drive?[/font][font=arial, sans-serif]<div>This is how you annoy a web developer.</span>[/font]

Link to comment
Share on other sites

  • 1 year later...

if you just type a minus:

---------------------------
AutoIt Error
---------------------------
Line 265  (File "calc2.au3"):
 
$aStack[uBound($aStack) - 1] -= $iLast
$aStack[^ ERROR
 
Error: Variable subscript badly formatted.
---------------------------
OK   
---------------------------
 
regards,
TheAutomator
Edited by TheAutomator
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...