C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
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
─────Run-Time Library───────────────────────────────────────────────────────
 
     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       _PLOSS     _TLOSS
     _OVERFLOW     _SING      _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 can be 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 a nonzero
     value to indicate successful corrective action.
                                    -♦-