Overview
This is a calculator which employs postfix notation and uses a stack to store its calculations. Postfix stack calculators and similar notational styles such as RPN, once learned, are much faster than using algebraic models.
Consider the following expression:
8 * 4 = 3
In Postfix, that would be 8 4 *.
Now, let's do a harder one:
2 + (3 * 8) - (4 + (48 / (4 + 2)) * 6)
We have to evaluate the parentheses first.
= 2 + 24 - (4 + (48 / 6) * 6) = 2 + 24 - (4 + 8 * 6) = 2 + 24 - (4 + 48) = 2 + 24 - 52 = -26
That is complicated for you and a calculator. Entering all the parentheses takes a lot of time. Consider the equivalent postfix notation.
2 3 8 * + 4 48 4 2 + / 6 * + -
How fast can you enter that last expression? I'm willing to bet it's much faster than you can find the parentheses for the first expression.
Features
- Postfix Style
- Any number of expressions.
- 10-position stack.
- Open Source
- Ant Build File.
License
Licensed under the GNU General Public License.
Learn more about GNU and free software at http://www.gnu.org/.
Download
calc.zip (16 KB)