HP (Hewlett-Packard) 32SII Calculator User Manual


 
13–16 Programming Techniques
File name 32sii-Manual-E-0424
Printed Date : 2003/4/24 Size : 17.7 x 25.2 cm
Keys: Display: Description:
c
+
format (denominator is factor of
16), then shows the fraction.
f
%

c
+
Message indicates the fraction
format (denominator is 16), then
shows the fraction.
f
{
x
{

}
0
)
Stops the program and clears flag
10
Loops
Branching backwards — that is, to a label in a previous line — makes it
possible to execute part of a program more than once. This is called looping.



"!

"!

"!
!

!
This routine (taken from the "Coordinate Transformations" program on page
15–31 in chapter 15) is an example of an infinite loop. It is used to collect the
initial data prior to the coordinate transformation. After entering the three
values, it is up to the user to manually interrupt this loop by selecting the
transformation to be performed (pressing
W
N for the old–to–new system
or
W
O for the new–to–old system).
Conditional Loops (GTO)
When you want to perform an operation until a certain condition is met, but
you don't know how many times the loop needs to repeat itself, you can
create a loop with a conditional test and a GTO instruction.
For example, the following routine uses a loop to diminish a value A by a
constant amount B until the resulting A is less than or equal to B.