intro(3M) DG/UX R4.11MU05 intro(3M)
NAME
intro - introduction to math libraries
SYNOPSIS
cc [flag ...] file ... -lm [library ...]
#include <math.h>
DESCRIPTION
This section describes the functions in the math library libm.
Declarations for these functions may be obtained from the #include
file math.h. Several generally useful mathematical constants are
also defined there [see intro(3) and math(5)].
The math libraries are not automatically loaded by the C compilation
system; use the -l option to cc to access the libraries as follows:
-lm Search the regular math library, libm.
libm Contains the full set of double-precision routines plus some
single-precision routines (designated by the suffix f) that
give better performance with less precision. Selected
routines are hand-optimized for performance. The optimized
routines include sin, cos, tan, atan, atan2, exp, log, log10,
pow, and sqrt and their single-precision equivalents.
DEFINITIONS
See intro(3) for C language definitions.
FILES
LIBDIR usually /usr/lib
LIBDIR/libm.a
SEE ALSO
cc(1), intro(2), intro(3), math(5).
The ``Floating Point Operations'' chapter in the Programmer's Guide:
ANSI C and Programming Support Tools.
DIAGNOSTICS
Error handling varies according to compilation mode. Under the -Xt
option to cc, these functions return the conventional values 0,
±HUGE, or NaN when the function is undefined for the given arguments
or when the value is not representable. In the -Xa (default) and -Xc
compilation modes, ±HUGEVAL is returned instead of ±HUGE. (HUGEVAL
and HUGE are defined in math.h to be infinity and the largest-
magnitude single-precision number, respectively.) In every case, the
external variable errno [see intro(2)] is set to the value EDOM or
ERANGE, although the value may vary for a given error depending on
compilation mode. See the table under matherr(3M) below.
Licensed material--property of copyright holder(s)