38 Section 3: The Memory Stack, LAST X, and Data Storage
Nested Calculations
The automatic stack lift and stack drop make it possible to do nested
calculations without using parentheses or storing intermediate results. A
nested calculation is solved simply as a series of one- and two-number
operations.
Almost every nested calculation you are likely to encounter can be done
using just the four stack registers. It is usually wisest to begin the
calculation at the innermost number or pair of parentheses and work
outward (as you would for a manual calculation). Otherwise, you may
need to place an intermediate result into a storage register. For example,
consider the calculation of
3 [4 + 5 (6 + 7)] :
Keystrokes Display
6 v 7 +
13.0000
Intermediate result of
(6+7).
5 *
65.0000
Intermediate result of
5 (6 + 7).
4 +
69.0000
Intermediate result of
[4 + 5 (6 + 7)].
3 *
207.0000
Final result:
3 [4 + 5 (6 + 7)].
The following sequence illustrates the stack manipulation in this
example. The stack automatically drops after each two-number
calculation, and then lifts when a new number is keyed in. (For simplicity,
throughout the rest of this handbook we will not show arrows between
the stacks.)
T
t z y y y
Z
z y x x y
Y
y x
6
6
x
X
x
6
6
7
13
Keys:
6
v
7
+