Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

intro(3) [v7 man page]

INTRO(3)						     Library Functions Manual							  INTRO(3)

NAME
intro - introduction to library functions SYNOPSIS
#include <stdio.h> #include <math.h> DESCRIPTION
This section describes functions that may be found in various libraries, other than those functions that directly invoke UNIX system primi- tives, which are described in section 2. Functions are divided into various libraries distinguished by the section number at the top of the page: (3) These functions, together with those of section 2 and those marked (3S), constitute library libc, which is automatically loaded by the C compiler cc(1) and the Fortran compiler f77(1). The link editor ld(1) searches this library under the `-lc' option. Declara- tions for some of these functions may be obtained from include files indicated on the appropriate pages. (3M) These functions constitute the math library, libm. They are automatically loaded as needed by the Fortran compiler f77(1). The link editor searches this library under the `-lm' option. Declarations for these functions may be obtained from the include file <math.h>. (3S) These functions constitute the `standard I/O package', see stdio(3). These functions are in the library libc already mentioned. Declarations for these functions may be obtained from the include file <stdio.h>. (3X) Various specialized libraries have not been given distinctive captions. The files in which these libraries are found are named on the appropriate pages. FILES
/lib/libc.a /lib/libm.a, /usr/lib/libm.a (one or the other) SEE ALSO
stdio(3), nm(1), ld(1), cc(1), f77(1), intro(2) DIAGNOSTICS
Functions in the math library (3M) may return conventional values when the function is undefined for the given arguments or when the value is not representable. In these cases the external variable errno (see intro(2)) is set to the value EDOM or ERANGE. The values of EDOM and ERANGE are defined in the include file <math.h>. ASSEMBLER
In assembly language these functions may be accessed by simulating the C calling sequence. For example, ecvt(3) might be called this way: setd mov $sign,-(sp) mov $decpt,-(sp) mov ndigit,-(sp) movf value,-(sp) jsr pc,_ecvt add $14.,sp INTRO(3)

Check Out this Related Man Page

INFNAN(3M)																INFNAN(3M)

NAME
infnan - signals invalid floating-point operations on a VAX (temporary) SYNOPSIS
#include <math.h> double infnan(iarg) int iarg; DESCRIPTION
At some time in the future, some of the useful properties of the Infinities and NaNs in the IEEE standard 754 for Binary Floating-Point Arithmetic will be simulated in UNIX on the DEC VAX by using its Reserved Operands. Meanwhile, the Invalid, Overflow and Divide-by-Zero exceptions of the IEEE standard are being approximated on a VAX by calls to a procedure infnan in appropriate places in libm. When better exception-handling is implemented in UNIX, only infnan among the codes in libm will have to be changed. And users of libm can design their own infnan now to insulate themselves from future changes. Whenever an elementary function code in libm has to simulate one of the aforementioned IEEE exceptions, it calls infnan(iarg) with an appropriate value of iarg. Then a reserved operand fault stops computation. But infnan could be replaced by a function with the same name that returns some plausible value, assigns an apt value to the global variable errno, and allows computation to resume. Alternatively, the Reserved Operand Fault Handler could be changed to respond by returning that plausible value, etc. instead of aborting. In the table below, the first two columns show various exceptions signaled by the IEEE standard, and the default result it prescribes. The third column shows what value is given to iarg by functions in libm when they invoke infnan(iarg) under analogous circumstances on a VAX. Currently infnan stops computation under all those circumstances. The last two columns offer an alternative; they suggest a setting for errno and a value for a revised infnan to return. And a C program to implement that suggestion follows. IEEE IEEE Signal Default iarg errno infnan __________________________________________________ Invalid NaN EDOM EDOM 0 Overflow +-Infinity ERANGE ERANGEHUGE Div-by-0 +-Infinity +-ERANGE ERANGE or EDOM+-HUGE (HUGE = 1.7e38 ... nearly 2.0**127) ALTERNATIVE infnan: #include <math.h> #include <errno.h> extern int errno ; double infnan(iarg) int iarg ; { switch(iarg) { case ERANGE: errno = ERANGE; return(HUGE); case -ERANGE: errno = EDOM; return(-HUGE); default: errno = EDOM; return(0); } } SEE ALSO
math(3M), intro(2), signal(3). ERANGE and EDOM are defined in <errno.h>. See intro(2) for explanation of EDOM and ERANGE. 4.3 Berkeley Distribution May 27, 1986 INFNAN(3M)
Man Page