RPN Calculator
Reverse Polish Notation, or RPN, is a math notation
where operators have a higher precedence than operands.
For example, 2 + 4 * 5 / 6 10
How Does RPN Work?
For the calculation above, we would write out each
step of the equation separately before adding them together. In order to
calculate the answer, we simply add the numbers together from left to right and
then subtract any negative results off. The result would look like this:
10
+ (-8) - 2 8
If the calculator was not written using RPN, the
first step would be to add the second number to the first number. Then we would
multiply the first number by the operation we were performing on the second
number. After that, we had to divide the third number by the second number and
finally we subtracted the second number from the result of the division.
Instead of writing out each step of the algorithm, we could just use RPN
instead. When done correctly, the calculator should work without errors.
0 Comments:
கருத்துரையிடுக
Thanks for Read the post