Oracle® Solaris Studio 12.4: Numerical Computation Guide

Exit Print View

Updated: January 2015
 
 

3.1.1 Standard Math Library

The Oracle Solaris standard math library, libm, contains elementary mathematical functions and support routines required by the various standards to which the Oracle Solaris operating environment conforms.

The Oracle Solaris 10 OS includes two versions of libm: libm.so.1 and libm.so.2. libm.so.1 provides the functions required by those standards supported by the Oracle Solaris 9 OS and earlier versions. libm.so.2 provides the functions required by those standards supported by the Oracle Solaris 10 OS (including C99). libm.so.1 is provided for backward compatibility so that programs compiled and linked on the Oracle Solaris 9 OS and earlier systems will continue to run unchanged. The contents of libm.so.1 are documented in the section 3M man pages on those systems. The remainder of this chapter refers to libm.so.2. See the ld(1) and compiler manual pages for more information about dynamic linking and the options and environment variables that determine which shared objects are loaded when a program is run.

Table 3–1 lists the functions in libm. For each mathematical function, the table gives only the name of the double precision version of the function. The library also contains a single precision version having the same name followed by an f and an extended/quadruple precision version having the same name followed by an l.

Table 3-1  Contents of libm 
Type
Function Name
Algebraic functions
cbrt, fdim, fma, fmax, fmin, hypot, sqrt
Elementary transcendental functions
asin, acos, atan, atan2, asinh, acosh, atanh, exp, exp2, expm1, pow, log, log1p, log10, log2, sin, cos, sincos, tan, sinh, cosh, tanh
Higher transcendental functions
j0, j1, jn, y0, y1, yn, erf, erfc, gamma, lgamma, gamma_r, lgamma_r, tgamma
Integral rounding functions
ceil, floor, llrint, llround, lrint, lround, modf, nearbyint, rint, round, trunc
IEEE standard recommended functions
copysign, fmod, ilogb, nextafter, remainder, scalbn, fabs
IEEE classification functions
isnan
Old style floating-point functions
frexp, ldexp, logb, scalb, significand
Error handling routine (user‐defined)
matherr
Complex functions
cabs, cacos, cacosh, carg, casin, casinh, catan, catanh, ccos, ccosh, cexp, cimag, clog, conj, cpow, cproj, creal, csin, csinh, csqrt, ctan, ctanh
C99 floating-point environment functions
feclearexcept, fegetenv, fegetexceptflag, fegetprec, fegetround, feholdexcept, feraiseexcept, fesetenv, fesetexceptflag, fesetprec, fesetround, fetestexcept, feupdateenv
Floating-point exception handling functions
fex_getexcepthandler, fex_get_handling, fex_get_log, fex_get_log_depth, fex_log_entry, fex_merge_flags, fex_setexcepthandler, fex_set_handling, fex_set_log, fex_set_log_depth
Other C99 functions
nan, nexttoward, remquo, scalbln

Note the following about Table 3–1:

1. The functions gamma_r and lgamma_r are re-entrant versions of gamma and lgamma.

2. The functions fegetprec and fesetprec are only available on x86 systems. These functions are not specified by the C99 standard.

3. Error bounds and observed errors for the transcendental functions in libm are tabulated on the libm(3LIB) man page.