Section 14: Flags continue225
Normally, the HP-41C halts execution and displays DATA ERROR when an improper operation (like division by zero) is performed. The HP-41C also halts execution and displays OUT OF RANGE when a range error occurs. When you set flag 25, however, the HP-41C will ignore a single improper operation. The operation is not performed but execution continues.
Note that when the improper operation is attempted, flag 25 is automatically cleared. Because the HP-41C clears flag 25 when an improper operation is attempted, it is a good idea to set the flag just prior to the line where you suspect an error might occur. You can also test the flag immediately after the suspect line. This allows you to prevent bad data from interrupting your program.
Range errors can be controlled by either flag 24 (range error ignore flag) of flag 25 (the error ignore flag) because range errors are also treated as errors. Flag 24 allows you to continue execution indefinitely when a range error occurs, and flag 25 allows you to detect a range error and take corrective action.
Example: The following program counts from 5 down to –5 and divides 5 by the count number. When the count reaches 0, normally a division by zero cause the program to stop execution. However, this program uses flag 25 to detect the division by zero and branch around the bad data value, continuing with –1. Here is a flowchart illustrating the program,