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. C programs should be linked with the -lm option in order to use this library.

<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, which may not be compatible with earlier BSD or UNIX implementations.

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-2 and Sun-3 systems without 68881 floating-point co-processors, 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.

IEEE EXCEPTION HANDLING
The IEEE Standard specifies exception handling for aint, ceil, floor, irint, remainder, rint, and sqrt, and suggests appropriate exception handling for fp_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's implementation of libm follows the SVID when it is consistent with the IEEE Standard and with hardware efficiency.

LIST OF MATH LIBRARY FUNCTIONS