Arithmetic-how the stack does it, Arithmetic - how the stack does it – HP 17bII+ User Manual

Page 270

Advertising
background image

270 E: RPN: The Stack

File name : English-M02-1-040308(Print).doc Print data : 2004/3/9

The

x

function is used primarily to swap the order of numbers in a

calculation. For example, an easy way to calculate 9

÷ (13x8) is to

press 13

E

8

*

9

x/

.

Arithmetic

How the Stack Does It

The contents of the stack move up and down automatically as new
numbers enter the X-register (lifting the stack), and as operators combine
two numbers to produce one new number in the X-register (dropping the
stack
). See how a full stack drops, lifts, and drops its contents while
calculating

3

+ 4 - 9 :

a (lost)

T

a

a

a

a

Z

b

a

b

a

Y

3

b

7

b

X

3
E
4

4

+

7

9

9

-

-2

Drop

Lift

Drop


(a and b represent values already on the stack.)

„ Notice that when the stack drops, it replicates the contents of the

T-register and overwrites the X-register.

„ When the stack lifts, it pushes the top contents out of the T-register,

and that number is lost. This shows that the stack’s memory is limited
to four numbers for calculations.

„ Because of the automatic movement of the stack, you do not need to

clear the display before doing a new calculation.

„ Most functions (except

E

and

C

) prepare the stack to lift its

contents when the next number enters the X-register.

Advertising