Reverse Polish Notation (RPN) (postfix Notation)
In reverse Polish notation, also known as postfix notation, all operations are entered after the operands on which the operation is performed. Reverse Polish notation is parenthesis-free which usually leads to fewer button presses needed to perform an operation. By the use of stack one can enter formulas without the need to rearrange operands. An example of a calculator which uses RPN is the HP 48G.
Formula | Key strokes | Key stroke count |
---|---|---|
1 ↵ Enter 2 ↵ Enter 3 × + | 7 | |
3 0 SIN 3 0 COS × | 7 | |
5 ↵ Enter 3 - | 4 | |
1 5 ↵ Enter 1 0 + 1 0 + 1 0 + | 12 |
Note example 1 which is one of the few examples where reverse Polish notation does not use the fewest button presses – provided one does not rearrange operands. If one would do so then only 6 key strokes would be needed.
Read more about this topic: Calculator Input Methods
Famous quotes containing the words reverse and/or polish:
“They shall beat their swords into plowshares, and their spears into pruninghooks: nation shall not lift up sword against nation, neither shall they learn war any more.”
—Bible: Hebrew Isaiah, 2:4.
The words reappear in Micah 4:3, and the reverse injunction is made in Joel 3:10 (Beat your plowshares into swords ...)
“The total and universal want of manners, both in males and females, is ... remarkable ... that polish which removes the coarser and rougher parts of our nature is unknown and undreamed of.”
—Frances Trollope (17801863)