HP 15c Manual
Have a look at the manual HP 15c Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 1114 HP manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.
Section 10: The Index Register and Loop Control 111 False (nnnnn > xxx) True (nnnnn xxx) instruction ´sV loop t. 1 Instruction exit loop For e: given nnnnn.xxxyy, decrement nnnnn to nnnnn - yy, compare it to xxx, and skip the next program line if the new value satisfies nnnnn ≤ xxx. This allows you to exit a loop at this point when nnnnn becomes less than or equal to xxx. For example, loop iterations will alter these control numbers as follows: Iterations Operation 0 1 2 3 4 I 0.00602 2.00602 4.00602 6.00602 8.00602 (skip next line) e 6.00002 4.00002 2.00002 0.00002 (skip next line) Examples Examples: Register Operations Storing and Recalling Keystrokes Display ´ CLEAR Q Clears all storage registers. 12.3456 12.3456 O V 12.3456 Stores in RI. 7 ¤ 2.6458 O% 2.6458 Storage in R.2 by indirect addressing (RI = 12.3456). lV 12.3456 Recalls contents of RI.
112 Section 10: The Index Register and Loop Control Keystrokes Display l % 2.6458 Indirectly recalls contents of R.2. ´ X .2 2.6458 Check: same contents recalled by directly addressing R.2. Exchanging the X-Register Keystrokes Display ´ X V 12.3456 Exchanges contents of RI and X- register. l V 2.6458 Present contents of RI. ´ X% 0.0000 Exchanges contents of R2 (which is zero) with X. l % 2.6458 ´ X 2 2.6458 Check: directly address R2. Storage Register Arithmetic Keystrokes Display 10 O + V 10.0000 Adds 10 to RI. l V 12.6458 New contents of RI (= old + 10). | $ O ÷ % 3.1416 Divides contents of R.2 by . l% 0.8422 New contents of R.2. ´ X.2 0.8422 Check: directly address R.2. Example: Loop Control with e Remember the program in section 8 which used a loop to calculate radioactive decay? (Refer to page 93.) This program used a test condition (x ≥ y?) to exit the loop when the calculated result passed the given limit (50). As weve seen in this section, theres another way to control loop execution: through a stored loop counter that is monitored by the I or e function.
Section 10: The Index Register and Loop Control 113 Here is a revision of the original radioisotope decay program. This time, we will limit the program to three executions of the loop rather than setting a specific limit value. This example uses e with a loop control number in R2 of 3.0 0 0 0 1. initial loop counter decrement value test (goal) value Make the following changes to the program (assuming it is in memory). A loop counter will be stored in R2 and a line number in the Index register. Keystrokes Display | ¥ 000- Program mode. t“013 013-43,30, 9 The second of the two loop test condition lines. −− 011- 42 31 Delete lines 013 and 012. ´e 2 012-42, 5, 2 Add your loop counter function (counter stored in R2). t V 013- 22 25 Go to given line number (015). Now when the loop counter (stored in R2) has reached zero, it will skip line 013 and go on to 014, the n instruction, thereby ending the program. If the loop counter has not yet decreased to zero, execution continues with line 013. This branches to line 015 and continues the program and the looping. To run the program, put t1 (day 1) in R0, N0 (initial isotope batch) in R1 the loop counter in R2, and the line number for branching in the Index register. Keystrokes Display | ¥ Run mode. 2 O 0 2.00000 t1. 100 O 1 100.0000 N0. 3.000001 O 2 3.0000 Loop counter. (This instruction could also be programmed.)
114 Section 10: The Index Register and Loop Control Keystrokes Display 15 “ O V ´ A -15.0000 Branch line number. 2.0000 Running program loop counter = 3. 84.0896 5.0000 Loop counter = 2. 64.8420 8.0000 Loop counter = 1. 50.0000 50.0000 Loop counter = 0; program ends. Example: Display Format Control The following program pauses and displays an example of • display format for each possible decimal place. It utilizes a loop containing a s instruction to automatically change the number of decimal places. Keystrokes |¥ ´CLEAR M ´ b B 9 nnnnn = 9. Therefore, xxx = 0 and by default yy = 1 (yy cannot be zero). O V ´ b 0 ´ • V l V ´ © Displays current value of nnnnn. ´ e V Value in RI is decremented and tested. Skip a line if nnnnn test value. t 0 Continue loop if nnnnn > test value (0). | T 1 Tests whether value in display is greater than 0, so loop will continue when nnnnn has reached 0 but display still only shows 1.0. t 0 | n
Section 10: The Index Register and Loop Control 115 To display fixed point notation for all possible decimal places on the HP-15C: Keystrokes Display | ¥ Run mode. ´ B 9.000000000 8.00000000 7.0000000 6.000000 5.00000 4.0000 3.000 2.00 1.0 0. Display at ´©instruction. 0. Display when program halts. Further Information Index Register Contents Any value stored in the Index register can be referenced in three different ways: Using V like any other storage register. The value in RI can be manipulated as it is: stored, recalled, exchanged, added to, etc. Using V as a control number. The absolute value of the integer portion in RI is a separate entity from the fractional portion. For indirect branching, flag control, and display format control with V, only this portion is used. For loop control, the fractional portion is also used, but separately from the integer portion.* Using % as a reference to the contents of another storage register. The % key uses the indirect addressing system shown in the tables on pages 107 and 108. (In turn, the contents of that second register may be used as a loop control number, in the fashion described above.) * This is also true for the value in any storage register used for indirect loop control.
116 Section 10: The Index Register and Loop Control I and e For the purpose of loop control, the integer portion (the counter value) of the stored control number can be up to five digits long (nnnnn.xxxyy). The counter value (nnnnn) is zero if not specified otherwise. xxx, in the decimal portion of the control number, must be specified as a three-digit number. (For example, ―5‖ must be ―005‖.) xxx is zero if not specified otherwise. Whenever I or e is encountered, nnnnn is compared internally to xxx, which represents the end level for incrementing or decrementing. yy must be specified as a two-digit number. yy cannot be zero, so if left (or specified) as 00, the value for yy defaults to 1. The value nnnnn is altered by the amount of yy each time the loop runs through I or e. Both yy and xxx are reference values, which do not change with loop execution. Indirect Display Control While you can use the Index register to format the display manually (that is, from the keyboard), this function is most commonly used in programming. This capability is especially valuable for the f function, for which accuracy can be stipulated by specifying the number of digits to be displayed (as described in section 14). There are, as usual, certain display limitations to keep in mind. Recall that any display format function merely alters the number of decimal places to which the display is rounded. In its memory, the calculator always retains a number in scientific notation as a 10-digit mantissa with a two-digit exponent. The integer portion of the number in the Index register specifies the number of decimal places to which the display is rounded. A number less than zero defaults to zero (zero decimal places displayed in • format), while a number greater than 9 defaults to 9 (9 decimal places displayed in •).* * Note that in i and ^ format modes, the maximum display is a seven-digit mantissa with a two-digit exponent. However, a format number greater than six (and less than or equal to nine) will alter the decimal place at which rounding occurs. (Refer to page 58-59.)
Section 10: The Index Register and Loop Control 117 An exception is in the case of f where the display format number in RI may range from -6 to +9. (This is discussed in appendix E on page 247.) A number less than zero will not affect the display format, but will affect accuracy with this function.
120 Section 11 Calculating With Complex Numbers The HP-15C enables you to calculate with complex numbers, that is, numbers of the form a + ib, where a is the real part of the complex number, b is the imaginary part of the complex number, and . As you will see, the beauty of calculating with the HP-15C in Complex mode is that once the complex numbers are keyed in, most operations are executed in the same manner as with real numbers. The Complex Stack and Complex Mode Calculations with complex numbers are performed using a complex stack composed of two parallel four-register stacks (and two LAST X registers). One of these parallel stacks – referred to as the real stack – contains the real parts of complex numbers used in calculations. (This is the same stack used in ordinary calculations.) The other stack – referred to as the imaginary stack – contains the imaginary parts of complex numbers used in calculations. Creating the Complex Stack The imaginary stack is created (by converting five storage registers as described in appendix C) when you activate Complex mode; it does not exist when the calculator is not in Complex mode. 1i