[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, 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 subroutine, exp, expm1, log, log10, log1p, pow subroutine, lgamma subroutine, hypot, cabs subroutine, sin, cos, tan, asin, acos, atan,atan2 subroutine, sinh, cosh, tanh subroutine.

Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]