Chapter Contents |
Previous |
Next |
_matherb |
Portability: | C99 |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
PORTABILITY | |
IMPLEMENTATION | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <lcmath.h> int _matherb(struct exception *x);
DESCRIPTION |
_matherb
is called whenever
an IEEE transcendental function detects an error. _matherb
receives an exception block as an argument describing the
error. This structure is defined in <lcmath.h>
:
struct exception { int type; /* error type */ _ _near char *name; /* name of failed function */ double arg1; /* first argument */ double arg2; /* second argument */ double retval; /* proposed return value */ int flterr; /* if non-0, failing function returns float */ };
The error type names defined in <lcmath.h>
are:
Error Type | Definition |
---|---|
DOMAIN | domain error |
SING | singularity |
OVERFLOW | overflow |
UNDERFLOW | underflow |
TLOSS | total loss of significance |
PLOSS | partial loss of significance |
RETURN VALUE |
If _matherb
returns 0,
a diagnostic message is written to the standard error file (stderr
). If _matherb
returns
a nonzero value, the diagnostic message is suppressed, and the calling function
will return the value stored in retval
to its
caller.
PORTABILITY |
Traditional UNIX C compilers support the functionality
of _matherb
using the name matherr
. Unfortunately, using the name matherr conflicts with
the ANSI Standard. However, the header file lcmath.h
contains the following macro:
#define matherr _matherb
If you include this header file, use the name that is compatible with traditional UNIX C compilers.
IMPLEMENTATION |
The standard version of _matherb
supplied in the library places the appropriate error number into the external
integer errno
and returns zero. When _matherb
is called, the function that detected the error places
its proposed return value into the exception structure. The zero return code
indicates that the proposed return value should not be changed.
Supply your own version of _matherb
if
desired. On particular errors, it may be desirable to cause the function detecting
the error to return a value other than its usual default. You can accomplish
this by storing a new return value in retval
of the exception structure and then returning a nonzero value from _matherb
, which forces the function to pick up the new value
from the exception structure. If a nonzero value is returned, a diagnostic
message is not printed for the error.
RELATED FUNCTIONS |
_matherr
, quiet
SEE ALSO |
"Mathematical Functions" in Chapter 2, "Function Categories"
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.