abakus supports some features not typically seen in computer calculators.
RPN Mode is a different input method for abakus, designed to emulate the input style of various old calculators which are still popular. If you do not already know what RPN Mode is, abakus is not the best way to find out. However, I will give a brief description of it.
In RPN Mode, the calculator operates from what is called the stack. Number are always added to the end of the stack, and operators always work from the end of the stack. One nice thing about RPN (and the reason it was developed in the first place) is that RPN expressions don't require parentheses, since the order of operations is completely unambiguous.
So the way things work is that in RPN mode, you type in numbers and operators separated by spaces. For each number you type, abakus will add to the end of the stack. Every time abakus encounters an operator, abakus will remove the appropriate number of values from the end of the stack, apply the operator, and then place the result back on the end of the stack. abakus continues in this fashion until it reaches the end of your expression, and then returns whatever value is left at the top of the stack as its result.
Let's see how this works with an example:
2 3 4 * + 2 /
would return
7
The way that this works is that first 2
, and then
3
are added to the end of the
stack. 4
is read and is also
added to the end. So at this point there are 3 numbers on the
stack. When abakus reads the operator
*
, it removes 3 and 4 from the end of the stack and
multiplies them, resulting in 12. 12 is then added to the end of the stack, and
the stack has 2 numbers (2 and 12).
abakus then reads the +
and performs the same
process, adding 12 and 2, and replacing them in the stack with 14.
2
is then added to the end, and then abakus performs
the division of 14 by 2, leaving 7 on the stack, which becomes the final
result.
You can also use functions in place of operators. For example,
pi 2 / sin
would calculate the value of sin(pi / 2).
If the stack has more than one element by the end of the expression, abakus will only remove the value at the end. The values left in the stack will be retained for later calculations. You can see how many values are on the stack using the special variable stackCount which appears in the Variable List while in RPN mode.
abakus supports a few special commands while in RPN mode, that affect the stack as follows:
pop
, which removes the value on the end
of the stack.
clear
, which clears the
stack completely.
The set
and remove
commands
are currently unsupported in RPN Mode.