The complex library has these definitions for error handling:
extern int errno; class c_exception { ... }; int complex_error(c_exception&);
The external variable errno is the global error state from the C library. errno can take on the values listed in the standard header errno.h (see the man page perror(3)). No function sets errno to zero, but many functions set it to other values.
To determine whether a particular operation fails:
The function complex_error takes a reference to type c_exception and is called by the following complex arithmetic library functions:
exp
log
log10
sinh
cosh
The default version of complex_error returns zero. This return of zero means that the default error handling takes place. You can provide your own replacement function complex_error that performs other error handling. Error handling is described in the man page cplxerr(3C++).
Default error handling is described in the man pages cplxtrig(3C++) and cplxexp(3C++) It is also summarized in the following table.
Table 2-3 Complex Arithmetic Library Functions
Complex Arithmetic Library Function |
Default Error Handling Summary |
---|---|
exp |
If overflow occurs, sets errno to ERANGE and returns a huge complex number. |
log, log10 |
If the argument is zero, sets errno to EDOM and returns a huge complex number. |
sinh, cosh |
If the imaginary part of the argument causes overflow, returns a complex zero. If the real part causes overflow, returns a huge complex number. In either case, sets errno to ERANGE. |