This is a manual for my Reverse Polish notation calculator tool, since a lot of people were confused.
Reverse Polish notation (RPN) or postfix notation is a way to write mathematical expressions. Unlike infix notation, which is probably what you're familiar with, operators are written after the numbers, not in between. For instance, if you want to write the sum of 3
and 4
, you'd do it like this in infix:
3 + 4Whereas in postfix:
3 4 +That's the basics of it, but it's somewhat more complicated than that (try to write
5/(3+4)
). Don't worry though, it's pretty easy.
You've got a stack of number blocks. You can only grab books from and push books to the top of the stack. Currently, it has no blocks, but let's give it some. For example, let's add 5
, 3
and 4
.
5... [ 5 ] 3... [ 3 ] [ 5 ] 4! [ 4 ] [ 3 ] [ 5 ]You've also got some magic spells you can use to apply operations to number blocks.
Let's do addition. [ 4 ]->|+++| [ 3 ]->|+++|->[ 7 ] [ 5 ] [ 5 ]