matherr man page on BSDi

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDi logo
[printable version]

MATHERR(3)		    BSD Programmer's Manual		    MATHERR(3)

NAME
     matherr - report errors in math library functions

SYNOPSIS
     #include <math.h>

     /* Modes: */
     typedef enum {
	     _IEEE_ = -1,
	     _SVID_,
	     _XOPEN_,
	     _POSIX_
     } _LIB_VERSION_TYPE;

     extern _LIB_VERSION_TYPE _LIB_VERSION;

     struct exception {
	     int type;
	     char *name;
	     double arg1;
	     double arg2;
	     double retval;
     };

     /* Types: */
     #define DOMAIN	     1
     #define SING	     2
     #define OVERFLOW	     3
     #define UNDERFLOW	     4
     #define TLOSS	     5
     #define PLOSS	     6

     int
     matherr(struct exception *exc);

DESCRIPTION
     The matherr() function is a function that math library functions (see
     math(3))  call when they detect an error.	Normally, you provide your own
     version of matherr() if you need to process math library errors special-
     ly.  This makes matherr() different from most library functions, which
     are not designed to be replaced by users.

     The matherr() function is only called from the math library in a very
     specific set of conditions:

     o	 You link your program to the generic math library, -lmstd. Hardware-
	 specific math libraries under BSD/OS support only IEEE 754 semantics.
     o	 You assign _XOPEN_ or _SVID_ to the global variable _LIB_VERSION be-
	 fore calling any math library function that may in turn need to call
	 matherr().  The default mode is _IEEE_, in which errors are reported
	 using exceptions (see fpgetsticky(3)).
     o	 You call a math library function that reports an error using
	 matherr(), as documented in that function's manual page.
     o	 Your code presents an exceptional condition for that math library
	 function, as documented in the manual page.

     If the return value of matherr() is nonzero, the error is ignored and
     errno is unaltered.  If the return value is 0, errno is set to EDOM or
     ERANGE to indicate the error appropriately.  If the return value is 0 and
     _LIB_VERSION is set to _SVID_, a message describing the error may be
     printed to stderr.

     Library functions call matherr() with a pointer to an exception struc-
     ture.  The members of this structure have the following meanings:

     type      The type of the error:
	       DOMAIN	   The value of an argument to the function is not in
			   the domain on which the function is defined.
	       SING	   The value of an argument to the function lies in a
			   singularity; the result of the function at this
			   point is infinite.
	       OVERFLOW	   The magnitude of the result of the function is
			   larger than the largest magnitude that the floating
			   point format can represent, even though the argu-
			   ments were finite and in the function's domain.
	       UNDERFLOW   The magnitude of the result of the function is
			   smaller than the smallest magnitude that the float-
			   ing point format can represent, even though the ar-
			   guments were finite and in the function's domain.
	       TLOSS	   The result of the function has a total loss of sig-
			   nificance.
	       PLOSS	   The result of the function has a partial loss of
			   significance.

     name      A string that represents the nul-terminated name of the func-
	       tion.

     arg1      The first argument to the function.

     arg2      The second argument to the function (if more than one).

     retval    The result of the function.  If matherr() changes this value,
	       the library function will appear to return the new value to the
	       caller.

     The library provides a default version of matherr().  The default
     matherr() always returns 0.  If the first argument to the function is an
     IEEE 754 NaN, it will report an invalid operation exception (see
     fpgetsticky(3)).

SEE ALSO
     math(3)

BUGS
     You can't replace a function in a static shared library, so programs that
     are compiled with shlicc(1) may not use matherr().

     It's not clear what version of the SVID, if any, this implementation
     might be compatible with.

BSDI BSD/OS			 March 4, 1998				     2
[top]

List of man pages available for BSDi

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net