intro(3M) — MATHEMATICAL LIBRARY
NAME
intro − introduction to the math library
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 reference manual pages are divided as follows:
• Commands Reference Manual, Volumes 1: Section 1 and all Section 1 subsections, and Section 5 manual pages related to commands.
• System Calls and Library Functions Reference Manual: Sections 2, 3, and all Section 3 subsections, and Section 5 manual pages related to programming.
• System Files and Devices Reference Manual: Sections 4 and 7.
The math library is not automatically loaded by the C compilation system; use the −l option to cc to access the library 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 may give better performance with less precision.
DEFINITIONS
See intro(3) for C language definitions.
FILES
LIBDIR usually /usr/ccs/lib
LIBDIR/libm.a
SEE ALSO
cc(1), intro(2), intro(3), math(5)
DIAGNOSTICS
Error handling varies according to compilation mode. Under the −Xt (default) 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 and −Xc compilation modes, ±HUGE_VAL is returned instead of ±HUGE. (HUGE_VAL 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.
— Math Libraries