[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


matherr Subroutine

Purpose

Math error handling function.

Library

System V Math Library (libmsaa.a)

Syntax

#include <math.h>

int matherr (x)
struct exception *x;

Description

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;

Parameters


type Specifies an integer describing the type of error that has occurred from the following list defined by the math.h file:

DOMAIN
Argument domain error

SING
Argument singularity

OVERFLOW
Overflow range error

UNDERFLOW
Underflow range error

TLOSS
Total loss of significance

PLOSS
Partial loss of significance.
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.

Return Values

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.

Error Codes

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.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The bessel: j0, j1, jn, y0, y1, yn (bessel: j0, j1, jn, y0, y1, or yn Subroutine) subroutine, exp, expm1, log, log10, log1p, pow (exp, expl, expm1, log, logl, log10, log10l, log1p, pow, or powl Subroutine) subroutine, lgamma (lgamma, lgammal, or gamma Subroutine) subroutine, hypot, cabs (hypot Subroutine) subroutine, sin, cos, tan, asin, acos, atan,atan2 subroutine, sinh, cosh, tanh subroutine.

Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]