T | ||||
Z | ||||
Y | ||||
X | ||||
The HP automatic memory stack and its associated logic, RPN, is the most efficient method available for solving complex problems. RPN, HP's logic system, was named in honor of a logic notation devised by the Polish mathematician Jan Lukasiewicz. In 1951, he showed that arbitrary mathematical expressions could be specified unambiguously without parentheses. Originally developed to make the evaluation of algebraic expressions as simple as possible, RPN has been implemented in HP calculators be means of the stack and postfix operators. The term "postfix operators" simply means that you specify the operation to be performed after, rather than before, you specify the number or numbers involved. RPN enables you to see all intermediate answers, to recover easily from errors, to reused numbers without reentering them, to solve problems one step at a time, and to evaluate virtually any expression without copying and remembering parentheses.
Four special registers in the HP-12C are used for storing numbers during calculations. To understand how these registers are used, they should be visualized as stacked on top of each other. (For this reason, they are generally referred to as the "stack registers" or collectively as "the stack.") The stack registers are designated X, Y, Z, and T. The number shown in the display is the number in the X-register (modified according to the current display format).
The number in the X-register--and, for two-number functions, the number in the Y-register--are the number(s) used in calculations. The Z- and T-registers are used primarily for automatic retention of intermediate results during chain calculations, as described below.
Let's take a quick look at how the stack is used in a simple arithmetic calculation and in a chain calculation. For each key pressed in the keysroke sequence, the diagram illustrating the calculation shows, above the key, the numbers in each of the stack registers after that key is pressed.
First, let's consider the calculation of 5 - 2:
T-reg | 0 | 0 | 0 | 0 |
Z-reg | 0 | 0 | 0 | 0 |
Y-reg | 0 | 5 | 5 | 0 |
X-reg | 5 | 5 | 2 | 3 |
Keys | 5 | E
N T E R |
2 | - |
T-reg | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Z-reg | 0 | 0 | 0 | 0 | 0 | 12 | 12 | 0 | 0 | 0 | 0 |
Y-reg | 0 | 3 | 3 | 0 | 12 | 5 | 5 | 12 | 0 | 42 | 0 |
X-reg | 3 | 3 | 4 | 12 | 5 | 5 | 6 | 30 | 42 | 7 | 6 |
Keys | 3 | E
N T E R |
4 | * | 5 | E
N T E R |
6 | * | + | 7 | / |
See how the intermediate results are not only displayed when they are calculated, but also automatically stored and available in the stack at just the right time!