Reverse Polish Notation Article Index for
Reverse
Website Links For
Reverse
 

Information About

Reverse Polish Notation




The first computers to implement architectures enabling RPN were the English Electric Company's KDF9 machine, which was announced in 1960 and delivered (i.e. made available commercially) in 1963, and the American Burroughs B5000, announced in 1961 and also delivered in 1963. One of the designers of the B5000, R. S. Barton, later wrote that he developed RPN independently of Hamblin, sometime in 1958 while reading a textbook on symbolic logic, and before he was aware of Hamblin's work.

Friden introduced RPN to the desktop calculator market with the EC-130 in June of 1963. Hewlett-Packard (HP) engineers designed the 9100A Desktop Calculator in 1968 with RPN. This calculator popularized RPN among the scientific and engineering communities, even though early advertisements for the 9100A failed to mention RPN. The HP-35 handheld scientific Calculator brought RPN to the first scientific pocket calculator in 1972 .

  • ( 4 + 7) would be written as 3 4 7 + ---, and done on an RPN calculator as "3", "Enter", "4", "Enter", "7", "+", "---". (Alternatively, and more compactly, it could also be re-ordered and written as 4 7 + 3 ---, and done on an RPN calculator as "4", "Enter", "7", "+", "3", "---".)


Implementations of RPN are Stack -based; that is, operands are popped from a stack, and calculation results are pushed back onto it. Although this concept may seem obscure at first, RPN has the advantage of being extremely easy, and therefore fast, for a computer to analyze.


PRACTICAL IMPLICATIONS


  • Calculations proceed from left to right.

  • There are no brackets or parentheses, as they are unnecessary.

  • There is no Equals key, but there is an Enter key.

  • Operands precede their operator. They are removed as the operation is evaluated.

  • When an operation is performed, the result becomes an operand itself (for later operators).

  • There is no hidden state: no need to wonder if an operator was entered or not.

  • Fewer keystrokes are needed on an RPN calculator than on an algebraic notation calculator for most computations.



DISADVANTAGES

  • A RPN electronic calculator requires the user to learn a new system of keying in equations, which may be difficult at first.

  • The widespread use of standard ordered equations ( Infix ) in educational systems (and therefore infix electronic calculators being the norm in classrooms) can make RPN impractical, hard, and hindering at times.

  • Most RPN electronic calculators have programmable functions and multiple memory registers. In formal examinations (such as licensing examinations) calculators with such extended functions are often banned, but using a simple infix calculator is both allowed and available.



EXAMPLE


  • 4) + 3 can be written down like this in RPN:

  • 3 +

  • The expression is evaluated in the following way (the ''Stack'' is displayed after ''Operation'' has taken place):


The final result, 15, lies on the top of the stack at the end of the calculation.

An alternate way of viewing the stack during the above operation is
shown below (as seen on HP48S calculator).

+


---+