Section 11: Branching and Looping163
 The modification creates an infinite loop in the program; it now computes an infinite series of numbers that approaches the value of pi. Run the program and watch the values as they approach π. Set the calculator to FIX 9 so you can see the complete display.

 00

 01 LBLTPFIND

 02 1 03 STO 00
Insert a LBL 01 after this
instruction.

 04 90

 05 RCL 00

 06 /

 07 SIN

 08 RCL 00 09 * 10 2 11 *
 Insert these instructions at the end of the program: PSE 10

 12 END

 ST* 00

 GTO 01
###### Controlled Looping
The HP-41C has two powerful functions that make looping in your programs very easy. These functions are ISG (increment and skip if greater) and DSE (decrement and skip if equal). Both functions contain internal counters that allow you to control the execution of the loop.
These two functions use a number that is interpreted in a special way to control program loops. The number is stored into any storage register (even the stack). The format of the number is:
 iiiii.fff.cc
where:
 iiiii is the current counter value, fff is the counter test value, and cc is the increment value.
The iiiii portion of the number tells the HP-41C that you wish to count the number of passes through the loop beginning with that number. If you do not specify an iiiii value, the HP-41C assumes you wish to begin counting at zero. An iiiii value can be specified as one to five digits.
The fff portion of the number tells the HP-41C that you wish to stop the counting at that number. The fff value must always be specified as a three-digit number (e.g., an fff value of 10 would be specified as 010). If you do not specify an fff value, the HP-41C assumes you wish to stop counting at zero.