The CHECK_MATH function returns and clears the accumulated math error status. The returned value is the sum of the bit values (described in Math Error Status Values (note that not all machines detect all errors) below) of the accumulated errors.
Floating-point operand error. An illegal operand was encountered, such as a negative operand to the SQRT or ALOG functions, or an attempt to convert to integer a number whose absolute value is greater than 2 31 - 1
Note that each type of error is only represented once in the return value--any number of "Integer divided by zero" errors will result in a return value of 1.
The math error status is cleared (reset to zero) when CHECK_MATH is called, or when errors are reported. Math errors are reported either never, when the interpreter returns to an interactive prompt, or after execution of each IDL statement, depending on the value of the !EXCEPT system variable (see ). See "Examples," below, for further discussion.
In this case, the math error status code (17) is printed, but because the error status has been cleared by the call to CHECK_MATH, no error messages are printed when IDL returns to the interactive command prompt. Finally,
Assume you have a critical section of code that is likely to produce an error. The following example shows how to check for errors, and if one is detected, how to repeat the code with different parameters.