INTRO(3M)

NAME
intro - introduction to mathematical library functions and constants

SYNOPSIS
#include <sys/ieeefp.h>

#include <floatingpoint.h>

#include <math.h>

DESCRIPTION
The include file <math.h> contains declarations of all the functions described in Section 3M that are implemented in the Math Library, libm. Functions in this library are automatically loaded as needed by the Fortran and Pascal compilers f77(1) and pc(1). The link editor searches this library in response to the “-lm” option.

<sys/ieeefp.h> and <floatingpoint.h> define certain types and constants used for libm exception handling conforming to ANSI/IEEE Std 754-1985, the IEEE Standard for Binary Floating-Point Arithmetic.

ACKNOWLEDGEMENT
The Sun version of libm is based upon and developed from ideas embodied and codes contained in 4.3 BSD Unix. Users may be misled be expectations based upon some earlier Unix implementations. Some of the more significant changes are discussed in the Floating-Point Programmer's Guide for the Sun Workstation .

IEEE ENVIRONMENT
The IEEE Standard specifies modes for rounding direction, precision, and exception trapping, and status reflecting accrued exceptions. These modes and status constitute the IEEE run-time environment. On Sun-1's, Sun-2's, and Sun-3's without 68881's, only the default rounding direction to nearest is available, only the default non-stop exception handling is available, and accrued exception bits are not maintained.

A more extensive discussion is in the Floating-Point Programmer's Guide .

IEEE EXCEPTION HANDLING
The IEEE Standard specifies exception handling for aint, ceil, floor, irint, remainder, rint, and sqrt, and suggests appropriate exception handling for class, copysign, fabs, finite, fmod, isinf, isnan, ilogb, ldexp, logb, nextafter, scalb, scalbn and signbit, but does not specify exception handling for the other libm functions. For these other unspecified functions the spirit of the IEEE Standard is generally followed in libm by handling invalid operand, singularity (division by zero), overflow, and underflow exceptions, as much as possible, in the same way they are handled for the fundamental floating-point operations such as addition and multiplication.

These unspecified functions are usually not quite correctly rounded, may not observe the optional rounding directions, and may not set the inexact exception correctly.

SYSTEM V EXCEPTION HANDLING
The System V Interface Definition (SVID) specifies exception handling for some libm functions: j0, j1, jn, y0, y1, yn, exp, log, log10, pow, sqrt, hypot, lgamma, sinh, cosh, sin, cos, tan, asin, acos, and atan2. See matherr(3M) for a discussion of the extent to which Sun libm follows SVID when it is consistent with the IEEE Standard and with hardware efficiency.

Further exception handling details may be found in the Floating-Point Programmer's Guide .

LIST OF FUNCTIONS

Name	Appears on Page	Description
acos	trig(3M)	inverse trigonometric functions
acosh	hyperbolic(3M)	inverse hyperbolic function
aint	rint(3M)	convert to integral value in floating-point format
anint	rint(3M)	convert to integral value in floating-point format
asin	trig(3M)	inverse trigonometric function
asinh	hyperbolic(3M)	inverse hyperbolic function
atan	trig(3M)	inverse trigonometric function
atan2	trig(3M)	rectangular to polar conversion
atanh	hyperbolic(3M)	inverse hyperbolic function
cbrt	sqrt(3M)	cube root
ceil	rint(3M)	ceiling function
class	ieee_functions(3M)	classify operand
copysign	ieee_functions(3M)	copy sign bit
cos	trig(3M)	trigonometric function
cosh	hyperbolic(3M)	hyperbolic function
erf	erf(3M)	error function
erfc	erf(3M)	complementary error function
exp	exp(3M)	exponential function
expm1	exp(3M)	exp(X)-1
exp2	exp(3M)	2**X
exp10	exp(3M)	10**X
fabs	ieee_functions(3M)	absolute value function
finite	ieee_functions(3M)	test for finite number
floor	rint(3M)	floor function
fmod	ieee_functions(3M)	floating-point remainder
frexp	frexp(3M)	floating-point analysis
hypot	hypot(3M)	Euclidean distance
ieee_flags	ieee_flags(3M)	IEEE modes and status
ieee_handler	ieee_handler(3M)	IEEE trapping
ilogb	ieee_functions(3M)	exponent extraction
infinity	ieee_values(3M)	returns double-precision IEEE infinity
irint	rint(3M)	convert to integral value in integer format
isinf	ieee_functions(3M)	IEEE classification
isnan	ieee_functions(3M)	IEEE classification
isnormal	ieee_functions(3M)	IEEE classification
issubnormal	ieee_functions(3M)	IEEE classification
iszero	ieee_functions(3M)	IEEE classification
j0	bessel(3M)	Bessel function
j1	bessel(3M)	Bessel function
jn	bessel(3M)	Bessel function
ldexp	frexp(3M)	exponent adjustment
lgamma	lgamma(3M)	log gamma function
log	exp(3M)	natural logarithm
logb	ieee_test(3M)	exponent extraction
log1p	exp(3M)	log(1+X)
log2	exp(3M)	log base 2
log10	exp(3M)	common logarithm
matherr	matherr(3M)	math library exception-handling routines
max_normal	ieee_values(3M)	returns double-precision IEEE largest positive normalized number
max_subnormal	ieee_values(3M)	returns double-precision IEEE largest positive subnormal number
min_normal	ieee_values(3M)	returns double-precision IEEE smallest positive normalized number
min_subnormal	ieee_values(3M)	returns double-precision IEEE smallest positive subnormal number
modf	frexp(3M)	floating-point analysis
nextafter	ieee_functions(3M)	IEEE nearest neighbor
nint	rint(3M)	convert to integral value in integer format
pow	exp(3M)	power X**Y
quiet_nan	ieee_values(3M)	returns double-precision IEEE quiet NaN
remainder	ieee_functions(3M)	floating-point remainder
rint	rint(3M)	convert to integral value in floating-point format
scalb	ieee_test(3M)	exponent adjustment
scalbn	ieee_functions(3M)	exponent adjustment
signaling_nan	ieee_values(3M)	returns double-precision IEEE signaling NaN
signbit	ieee_functions(3M)	IEEE sign bit test
significand	ieee_test(3M)	scalb(x,-ilogb(x))
sin	trig(3M)	trigonometric function
single_precision	single_precision(3M)	Single-precision libm access
sinh	hyperbolic(3M)	hyperbolic function
sqrt	sqrt(3M)	square root
tan	trig(3M)	trigonometric function
tanh	hyperbolic(3M)	hyperbolic function
y0	bessel(3M)	Bessel function
y1	bessel(3M)	Bessel function
yn	bessel(3M)	Bessel function