Windows PowerShell command on Get-command matherr
MyWebUniversity

Manual Pages for UNIX Operating System command usage for man matherr

Mathematical Library Functions matherr(3M)

NAME

matherr - math library exception-handling function

SYNOPSIS

#include

int matherr(struct exception *exc);

DESCRIPTION

The System V Interface Definition, Third Edition (SVID3)

specifies that certain libm functions call matherr() when

exceptions are detected. Users may define their own mechan-

isms for handling exceptions, by including a function named

matherr() in their programs. The matherr() function is of

the form described above. When an exception occurs, a pointer to the exception structure exc will be passed to the

user-supplied matherr() function. This structure, which is

defined in the header file, is as follows: struct exception { int type; char *name; double arg1, arg2, retval; };

The type member is an integer describing the type of excep-

tion that has occurred, from the following list of constants (defined in the header file): DOMAIN argument domain exception SING argument singularity OVERFLOW overflow range exception UNDERFLOW underflow range exception TLOSS total loss of significance PLOSS partial loss of significance

SunOS 5.11 Last change: 23 Sep 1997 1

Mathematical Library Functions matherr(3M)

Both TLOSS and PLOSS reflect limitations of particular algo-

rithms for trigonometric functions that suffer abrupt declines in accuracy at definite boundaries. Since the implementation does not suffer such abrupt declines, PLOSS is never signaled. TLOSS is signaled for Bessel functions only to satisfy SVID3 requirements. The name member points to a string containing the name of the function that incurred the exception. The arg1 and arg2 members are the arguments with which the function was invoked. retval is set to the default value that will be

returned by the function unless the user's matherr() sets it

to a different value.

If the user's matherr() function returns non-zero, no excep-

tion message will be printed and errno is not set. SVID3 STANDARD CONFORMANCE

When an application is built as a SVID3 conforming applica-

tion (see standards(5)), if matherr() is not supplied by the

user, the default matherr exception-handling mechanisms,

summarized in the table below, are invoked upon exception: DOMAIN 0.0 is usually returned, errno is set to EDOM and a message is usually printed on standard error.

SING The largest finite single-precision number,

HUGE of appropriate sign, is returned, errno is

set to EDOM, and a message is printed on stan-

dard error.

OVERFLOW The largest finite single-precision number,

HUGE of appropriate sign, is usually returned and errno is set to ERANGE. UNDERFLOW 0.0 is returned and errno is set to ERANGE. TLOSS 0.0 is returned, errno is set to ERANGE, and a message is printed on standard error. In general, errno is not a reliable error indicator because it can be unexpectedly set by a function in a handler for an asynchronous signal.

SunOS 5.11 Last change: 23 Sep 1997 2

Mathematical Library Functions matherr(3M)

SVID3 ERROR HANDLING PROCEDURES (compile with cc \-Xt)

SunOS 5.11 Last change: 23 Sep 1997 3

Mathematical Library Functions matherr(3M)

______________________________________________________________________________________________________________

| type | DOMAIN | SING | OVERFLOW | UNDERFLOW | TLOSS |

|_______________________________|___________________|__________________|_____________|______________|_________|

| errno | EDOM | EDOM | ERANGE | ERANGE | ERANGE |

|_______________________________|___________________|__________________|_____________|______________|_________|

| IEEE Exception | Invalid Operation| Division by Zero| Overflow | Underflow | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| fp_exception_type | fp_invalid | fp_division | fp_overflow| fp_underflow| - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| ACOS, ASIN(|x| > 1): | Md, 0.0 | - | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| ACOSH(x < 1), ATANH(|x| > 1): | NaN | - | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| ATAN2(0,0): | Md, 0.0 | - | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| COSH, SINH: | - | - | +_HUGE | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| EXP: | - | - | +HUGE | 0.0 | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| FMOD(x,0): | x | - | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| HYPOT: | - | - | +HUGE | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| J0, J1, JN(|x| > X_TLOSS): | - | - | - | - | Mt, 0.0|

|_______________________________|___________________|__________________|_____________|______________|_________|

| LGAMMA: | | | | | |

| usual cases | - | - | +HUGE | - | - |

| (x = 0 or -integer) | - | Ms, +HUGE | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| LOG, LOG10: | | | | | |

| (x < 0) | Md, -HUGE | - | - | - | - |

| (x = 0) | - | Ms, -HUGE | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| POW: | | | | | |

| usual cases | - | - | +_HUGE | +_0.0 | - |

| (x < 0) ** (y not an integer)| Md, 0.0 | - | - | - | - |

| 0 ** 0 | Md, 0.0 | - | - | - | - |

| 0 ** (y < 0) | Md, 0.0 | - | - | - | |

|_______________________________|___________________|__________________|_____________|______________|_________|

| REMAINDER(x,0): | NaN | - | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| SCALB: | - | - | +_HUGE_VAL | +_0.0 | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| SQRT(x < 0): | Md, 0.0 | - | - | - | - |

|_______________________________|___________________|__________________|_____________|______________|_________|

| Y0, Y1, YN: | | | | | |

| (x < 0) | Md, -HUGE | - | - | - | - |

| (x = 0) | - | Md, -HUGE | - | - | - |

| (x > X_TLOSS) | - | - | - | - | Mt, 0.0|

|_______________________________|___________________|__________________|_____________|______________|_________|

SunOS 5.11 Last change: 23 Sep 1997 4

Mathematical Library Functions matherr(3M)

Abbreviations Md Message is printed (DOMAIN error). Ms Message is printed (SING error). Mt Message is printed (TLOSS error). NaN IEEE NaN result and invalid operation exception.

HUGE Maximum finite single-precision floating-point

number.

HUGE_VAL IEEE oo result and division-by-zero exception.

X_TLOSS The value X_TLOSS is defined in .

The interaction of IEEE arithmetic and matherr() is not

defined when executing under IEEE rounding modes other than

the default round to nearest: matherr() is not always called

on overflow or underflow and can return results that differ from those in this table.

X/OPEN COMMON APPLICATION ENVIRONMENT (CAE) SPECIFICATIONS

The X/Open System Interfaces and Headers (XSH) Issue 3 and later revisions of that specification no longer sanctions

the use of the matherr interface. The following table sum-

marizes the values returned in the exceptional cases. In general, XSH dictates that as long as one of the input argument(s) is a NaN, NaN is returned. In particular, pow(NaN,0) = NaN.

CAE SPECIFICATION ERROR HANDLING PROCEDURES (compile with cc

-Xa)

SunOS 5.11 Last change: 23 Sep 1997 5

Mathematical Library Functions matherr(3M)

SunOS 5.11 Last change: 23 Sep 1997 6

Mathematical Library Functions matherr(3M)

_________________________________________________________________________________________________

| type | DOMAIN | SING | OVERFLOW | UNDERFLOW | TLOSS |

|_______________________________|_____________|_____________|_____________|____________|_________|

| errno | EDOM | EDOM | ERANGE | ERANGE | ERANGE |

|_______________________________|_____________|_____________|_____________|____________|_________|

| ACOS, ASIN(|x| > 1): | 0.0 | - | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| ATAN2(0,0): | 0.0 | - | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| COSH, SINH: | - | - | {+_HUGE_VAL}| - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| EXP: | - | - | {+HUGE_VAL}| {0.0} | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| FMOD(x,0): | {NaN} | - | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| HYPOT: | - | - | {+HUGE_VAL}| - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| J0, J1, JN(|x| > X_TLOSS): | - | - | - | - | {0.0} |

|_______________________________|_____________|_____________|_____________|____________|_________|

| LGAMMA: | | | | | |

| usual cases | - | - | {+HUGE_VAL}| - | - |

| (x = 0 or -integer) | - | +HUGE_VAL | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| LOG, LOG10: | | | | | |

| (x < 0) | -HUGE_VAL | - | - | - | - |

| (x = 0) | - | -HUGE_VAL | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| POW: | | | | | |

| usual cases | - | - | +_HUGE_VAL | +_0.0 | - |

| (x < 0) ** (y not an integer)| 0.0 | - | - | - | - |

| 0 ** 0 | {1.0} | - | - | - | - |

| 0 ** (y < 0) | {-HUGE_VAL}| - | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| SQRT(x < 0): | 0.0 | - | - | - | - |

|_______________________________|_____________|_____________|_____________|____________|_________|

| Y0, Y1, YN: | | | | | |

| (x < 0) | {-HUGE_VAL}| - | - | - | - |

| (x = 0) | - | {-HUGE_VAL}| - | - | - |

| (x > X_TLOSS) | - | - | - | - | 0.0 |

|_______________________________|_____________|_____________|_____________|____________|_________|

Abbreviations {...} errno is not to be relied upon in all braced cases. NaN IEEE NaN result and invalid operation exception.

HUGE_VAL IEEE oo result and division-by-zero exception.

SunOS 5.11 Last change: 23 Sep 1997 7

Mathematical Library Functions matherr(3M)

X_TLOSS The value X_TLOSS is defined in .

ANSI/ISO-C STANDARD CONFORMANCE

The ANSI/ISO-C standard covers a small subset of the CAE

specification. The following table summarizes the values returned in the exceptional cases.

ANSI/ISO-C ERROR HANDLING PROCEDURES (compile with cc -Xc)

SunOS 5.11 Last change: 23 Sep 1997 8

Mathematical Library Functions matherr(3M)

________________________________________________________________________________________

| type | DOMAIN | SING | OVERFLOW | UNDERFLOW |

|_______________________________|_____________|_____________|_____________|_____________|

| errno | EDOM | EDOM | ERANGE | ERANGE |

|_______________________________|_____________|_____________|_____________|_____________|

| ACOS, ASIN(|x| > 1): | 0.0 | - | - | - |

|_______________________________|_____________|_____________|_____________|_____________|

| ATAN2(0,0): | 0.0 | - | - | - |

|_______________________________|_____________|_____________|_____________|_____________|

| EXP: | - | - | +HUGE_VAL | 0.0 |

|_______________________________|_____________|_____________|_____________|_____________|

| FMOD(x,0): | NaN | - | - | - |

|_______________________________|_____________|_____________|_____________|_____________|

| LOG, LOG10: | | | | |

| (x < 0) | -HUGE_VAL | - | - | - |

| (x = 0) | - | -HUGE_VAL | - | - |

|_______________________________|_____________|_____________|_____________|_____________|

| POW: | | | | |

| usual cases | - | - | +_HUGE_VAL | +_0.0 |

| (x < 0) ** (y not an integer)| 0.0 | - | - | - |

| 0 ** (y < 0) | -HUGE_VAL | - | - | - |

|_______________________________|_____________|_____________|_____________|_____________|

| SQRT(x < 0): | 0.0 | - | - | - |

|_______________________________|_____________|_____________|_____________|_____________|

ABBREVIATIONS NaN IEEE NaN result and invalid operation exception.

HUGE_VAL IEEE oo result and division-by-zero.

EXAMPLES

Example 1 Example of matherr() function

#include

#include

#include

int

matherr(struct exception *x) {

switch (x->type) {

case DOMAIN:

/* change sqrt to return sqrt(-arg1), not NaN */

if (!strcmp(x->name, "sqrt")) {

x->retval = sqrt(-x->arg1);

return (0); /* print message and set errno */ } /* FALLTHRU */ case SING: /* all other domain or sing exceptions, print message and */ /* abort */

SunOS 5.11 Last change: 23 Sep 1997 9

Mathematical Library Functions matherr(3M)

fprintf(stderr, "domain exception in %s\n", x->name);

abort( ); break; } return (0); /* all other exceptions, execute default procedure */ }

ATTRIBUTES

See attributes(5) for descriptions of the following attri-

butes:

____________________________________________________________

| ATTRIBUTE TYPE | ATTRIBUTE VALUE |

|_____________________________|_____________________________|

| MT-Level | MT-Safe |

|_____________________________|_____________________________|

SEE ALSO

attributes(5), standards(5)

SunOS 5.11 Last change: 23 Sep 1997 10




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™