Math error handling function.
System V Math Library (libmsaa.a)
#include <math.h>
int matherr (x)
struct exception *x;
The matherr subroutine is called by math library routines when errors are detected.
You can use matherr or define your own procedure for handling errors by creating a function named matherr in your program. Such a user-designed function must follow the same syntax as matherr. When an error occurs, a pointer to the exception structure will be passed to the user-supplied matherr function. This structure, which is defined in the math.h file, includes:
int type;
char *name;
double arg1, arg2, retval;
Item | Description |
---|---|
type | Specifies an integer describing the type of error that has
occurred from the following list defined by the math.h file:
|
name | Points to a string containing the name of the routine that caused the error. |
arg1 | Points to the first argument with which the routine was invoked. |
arg2 | Points to the second argument with which the routine was invoked. |
retval | Specifies the default value that is returned by the routine unless the user's matherr function sets it to a different value. |
If the user's matherr function returns a non-zero value, no error message is printed, and the errno global variable will not be set.
If the function matherr is not supplied by the user, the default error-handling procedures, described with the math library routines involved, will be invoked upon error. In every case, the errno global variable is set to EDOM or ERANGE and the program continues.