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:
“Now listen, buddy, there are a few corny ideas you got to get out of your head if youre going to fly an airplane. Most things are just the reverse from what people think. The higher you are the safer you are. The Earth down there, that, thats your enemy because once you hit that, boy, you splatter.”
—Dalton Trumbo (19051976)
“Then I polish all the silver, which a supper-table lacquers;
Then I write the pretty mottoes which you find inside the
crackers”
—Sir William Schwenck Gilbert (18361911)