# RPN Calculator

## 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

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]

##### 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]

##### 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

---------------------------
OK
---------------------------

regards,
TheAutomator
Edited by TheAutomator
##### Share on other sites

Thank you for shareing this will help a lot as I am also trying to make a Math Evalulator for a project I am working on.

On Error Resume Pulling Hair Out.

## Create an account

Register a new account

• ### Similar Content

• #### simple date calculator

By nacerbaaziz,

• 4 replies
• 1,603 views
• #### PAL timecode calculator UDF

By imitto,

• 2,113 views
• #### My rpn calculator can't compute negative numbers... 1 2

By TheAutomator,

• 30 replies
• 13,698 views
• #### Shunting-Yard algorithm

By guinness,

• 2 replies
• 7,090 views
• #### Ohm's Law Calculator

By careca,

• 5,174 views
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...