Error Handling, Underflow, Overflow, and Document Examples
The functions in the IMSL C Math Library attempt to detect and report errors and invalid input. This error-handling capability provides automatic protection for the user without requiring the user to make any specific provisions for the treatment of error conditions. Errors are classified according to severity and are assigned a code number. By default, errors of moderate or higher severity result in messages being automatically printed by the function. Moreover, errors of highest severity cause program execution to stop. The severity level, as well as the general nature of the error, is designated by an “error type” with symbolic names IMSL_FATAL, IMSL_WARNING, etc. See the User Errors section in the “Reference Material” for further details.
In general, the IMSL C Math Library codes are written so that computations are not affected by underflow, provided the system (hardware or software) replaces an underflow with the value zero. Normally, system error messages indicating underflow can be ignored.
IMSL codes are also written to avoid overflow. A program that produces system error messages indicating overflow should be examined for programming errors such as incorrect input data, mismatch of argument types, or improper dimensions.
In many cases, the documentation for a function points out common pitfalls that can lead to failure of the algorithm.
Output from document examples can be system dependent and the user’s results may vary depending upon the system used.