** For a much more detailed explanation, please see the RPNCalc homepage at https://github.com/frossm/rpncalc **
With a Reverse Polish Notation (RPN) calculator it is easy to do complex calculations, especially if there are parentheses involved. For example, to perform the following calculation:
x = SQRT((((5+3) * 8)/2) ^ 6)
RPN Steps: 5 enter 3 + 8 * 2 / 6 ^ SQRT
You start on the inside and work yourself out. It's based on a stack and really makes intuitive sense when you use one.
Over the years I've used various RPN calculators on my computer, but I failed to find a simple command line version that I liked. Therefore, I decided to write one. It was easy to write, easily extensible, and since it's in Java, should run wherever I need it to run.
If you have not heard of an RPN calculator, or just enjoying reading about various calculator notations, here is a link to the Wikipedia Article : https://en.wikipedia.org/wiki/Reverse_Polish_notation
To execute a Java jar file, you need to have a Java Run-time Environment, (JRE) installed and and in your path.
To Execute: java.exe -jar rpncalc.jar
** High Level Usage ** RPNCalc is a console application that will start at a prompt. Entering 'h [ENTER]' will display the in-program help page. This lists all of the commands and operands that can be used, but it is fairly terse. On this command line you'll enter numbers and press enter. These will then be added to the stack. RPNCalc operates on a stack where first in is last out. You can then enter in an operand, such as + or /, to perform the action on the items at the end of the stack. So to add two numbers you can simply enter 2 [ENTER] which add the number 2 to the stack. Then 3 [ENTER] which will put it on top of the stack (which is the bottom in the program). Then + [ENTER] to add them. The 2 and 3 come off the stack and 5 is added. As a shortcut, for the basic operands, you can skip a step by entering 3+ [ENTER] and the end and it will perform the shortcut. I'm not going to into a lot of detail on how an RPN calculator works, that's Wikipedia's job, but it's fairly easy. Once I got the hand of it, I rarely use another style.
One note is that the stack always contains decimal numbers. You can enter in a simple fraction and it will convert it. For example:
1 5/16 [ENTER] will add 1.3125 to the stack
14/8 [ENTER] will add 1.75 to the stack
Savings Stacks One of the important uses for me is I wanted to be able to save my stacks for future instances of the program. I also wanted to have a secondary stack that I could toggle in case I wanted to do some work and then toggle back to the primary stack. Lastly, I wanted to be able to name and save a stack that could be loaded at another time. All of this is build into the program. For example, I have a saved stack called "Checkbook". While I use RPNCalc with the default stack most of the time, when I write a check, I load RPNCalc with the 'Checkbook' stack and it will load and auto save when done.
** See Developer Website for details on options and commands **