Go to main content
Oracle® Developer Studio 12.5: Numerical Computation Guide

Exit Print View

Updated: June 2016
 
 

3.1 Oracle Solaris Math Libraries

This section describes the math libraries that are bundled with the Oracle Solaris 10 OS. These libraries are provided as shared objects and are installed in the standard location for Oracle Solaris libraries.

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 14 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 14  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 14:

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.

3.1.2 Vector Math Library

The library libmvec provides routines that evaluate common mathematical functions for an entire vector of arguments. An application might invoke the routines in libmvec explicitly, or the compiler might invoke these routines when the –xvector flag is used.

libmvec is implemented as a primary shared object, libmvec.so.1, and several auxiliary shared objects that provide alternate versions of some or all of the vector functions. When a program linked with libmvec is run, the runtime linker automatically selects the version that offers the best performance on the host platform. For this reason, a program that uses the functions in libmvec might deliver slightly different results when run on different systems.

Table 15 lists the functions in libmvec.

Table 15  Contents of libmvec
Type
Function Name
Algebraic functions
vhypot_, vhypotf_, vrhypot_, vrhypotf_, vrsqrt_, vrsqrtf_, vsqrt_, vsqrtf_
Exponential and related functions
vexp_, vexpf_, vlog_, vlogf_, vpow_, vpowf_
Trigonometric functions
vatan_, vatanf_, vatan2_, vatan2f_, vcos_, vcosf_, vsin_, vsinf_, vsincos_, vsincosf_
Complex functions
vc_abs_, vc_exp_, vc_log_, vc_pow_, vz_abs_, vz_exp_, vz_log_, vz_pow_