Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
matherr, _matherrl
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The matherr functions process errors generated by the functions of
the math library. These functions call the appropriate matherr
routine whenever an error is detected. The _matherrl function uses
the 80-bit long double form of arguments and return values.
You can provide a different definition of the matherr functions to
carry out special error handling.
When an error occurs in a math routine, matherr is called with a
pointer to an exception type structure (defined in MATH.H) as an
argument.
The exception structure contains the following elements:
Element Description
int type Exception type
char * name Name of function where error occurred
double arg1, arg2 First & second (if any) argument to function
double retval Value to be returned by function
The structure member type specifies the type of math error. It is
one of the following values, defined in MATH.H:
DOMAIN SING
OVERFLOW TLOSS
PLOSS UNDERFLOW
The structure member name is a pointer to a null-terminated string
containing the name of the function that caused the error. The
structure members <arg1> and <arg2> specify the values that caused
the error. (If only one argument is given, it is stored in
<arg1>.)
The default return value for the given error is <retval>. If you
change the return value, remember that the return value must
specify whether an error actually occurred.
If matherr returns 0, an error message is displayed and errno is
set to an appropriate error value. If matherr returns a nonzero
value, no error message is displayed, and errno remains unchanged.
Return Value
The matherr functions return 0 to indicate an error and nonzero to
indicate successful corrective action.
-♦-