Example: Using Flags.

The "Curve Fitting" program in chapter 16 uses flags 0 and 1 to determine whether to take the natural logarithm of the X– and Y–inputs:

„Lines S0003 and S0004 clear both of these flags so that lines W0007 and W0011 (in the input loop routine) do not take the natural logarithms of the X– and Y–inputs for a Straight–line model curve.

„Line L0003 sets flag 0 so that line W0007 takes the natural log of the X–input for a Logarithmic–model curve.

„Line E0004 sets flag 1 so that line W0011 takes the natural log of the Y–input for an Exponential–model curve.

„Lines P0003 and P0004 set both flags so that lines W0007 and W0011 take the natural logarithms of both the X– and Y–inputs for a Power–model curve.

Note that lines S0003, S0004, L0004, and E0003 clear flags 0 and 1 to ensure that they will be set only as required for the four curve models.

13–12Programming Techniques

Page 196
Image 196
HP 33s Scientific manual 13-12Programming Techniques, Example Using Flags