# RPN Calculator

#### This calculator operates in RPN, that is, Reverse Polish Notation.

You can use the simple Postfix "RPN" calculator below. When solving ambiguous evaluation order with RPN, brackets are not used to show "order of operation", for example when solving (2 + 4) * 5. The intermediate results are instead stacked until the final results are needed. The "equals" key does not exist in RPN. Furthermore, complex equations require fewer keystrokes, and those calculations are less likely to be inaccurate.

The basic idea of RPN is to represent the program as a stack of operators, where each operator on the stack represents one arithmetic or algebraic calculation step. The first step on the stack is usually designated by a special symbol such as "expression" or "symbol".

Reverse Polish Notation is one of the simplest ways to represent a list of numbers in a computer program.

I have included some examples of how to use an RPN calculator below the calculator.

Z:
Y:
X:
RPN Calculator

Example 1: solve 3 + 5

Classical calculator keystrokes are 3 + 5 = giving an answer of 8

RPN calculator keystrokes are 3 Enter 5 + giving an answer of 8

Notes - both methods required 4 keystrokes, so same amount of work.

Example 2: solve (3 + 5) * (6 - 2)

Classical calculator keystrokes are ( 3 + 5 ) * ( 6 - 2 ) = giving an answer of 32

RPN calculator keystrokes are 3 Enter 5 + 6 Enter 2 - * giving an answer of 32

Notes - first method required 12 keystrokes, second method required 9. Using RPN saved 3 keystrokes.