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

Exit Print View

Updated: July 2017
 
 

3.2 Oracle Developer Studio Math Libraries

This section describes the math libraries that are included with the Oracle Developer Studio compilers.

The default base installation directory for Oracle Developer Studio 12.6 is /opt/developerstudio12.6 on Oracle Solaris and /opt/oracle/developerstudio12.6 on Linux. However, you can specify a different base installation directory install-dir during installation.

Oracle Developer Studio static 32-bit libraries are installed by default in the directory install-dir/lib/compilers and its subdirectories. Static 64-bit libraries are installed in install-dir/lib/compilers/sparcv9 on SPARC and install-dir/lib/compilers/amd64 on x86.

This Numerical Computation Guide also describes the shared libm and libmvec libraries, which are available for Oracle Solaris only and are installed in /usr/lib for 32-bit versions and /usr/lib/64 for 64-bit versions.

The math.h and sunmath.h library header files are installed in /usr/include for Oracle Solaris. The math.h library header file is installed in install-dir/lib/compilers/include/cc for Linux.

The subdirectories of your Oracle Developer Studio install-dir for static archives, shared objects, and include files are subject to change from release to release.

3.2.1 Oracle Math Library

The libsunmath math library contains functions that are not specified by any standard but are useful in numerical software. It also contains many of the functions that are in libm.so.2 but not in libm.so.1. libsunmath is provided as both a shared object and a static archive.

Table 16 lists the functions in libsunmath that are not in libm.so.2. For each mathematical function, the table gives only the name of the double precision version of the function as it would be called from a C program.

Table 16  Contents of libsunmath
Type
Function Name
Elementary transcendental functions
exp10
Trigonometric functions in degrees
asind, acosd, atand, atan2d, sind, cosd, sincosd, tand
Trigonometric functions scaled in ??
asinpi, acospi, atanpi, atan2pi, sinpi, cospi, sincospi, tanpi
Trigonometric functions with double precision ?? argument reduction
asinp, acosp, atanp,sinp, cosp, sincosp, tanp
Financial functions
annuity, compound
Integral rounding functions
aint, anint, irint, nint
IEEE standard recommended functions
signbit
IEEE classification functions
fp_class, isinf, isnormal, issubnormal, iszero
Functions that supply useful IEEE values
min_subnormal, max_subnormal, min_normal, max_normal, infinity, signaling_nan, quiet_nan
Additive random number generators
i_addran_, i_addrans_, i_init_addrans_, i_get_addrans_, i_set_addrans_, r_addran_, r_addrans_, r_init_addrans_, r_get_addrans_, r_set_addrans_, d_addran_, d_addrans_, d_init_addrans_, d_get_addrans_, d_set_addrans_, u_addrans_
Linear congruential random number generators
i_lcran_, i_lcrans_, i_init_lcrans_, i_get_lcrans_, i_set_lcrans_, r_lcran_, r_lcrans_, d_lcran_, d_lcrans_, u_lcrans_
Multiply-with-carry random number generators
i_mwcran_, i_mwcrans_, i_init_mwcrans_, i_get_mwcrans_, i_set_mwcrans, i_lmwcran_, i_lmwcrans_, i_llmwcran_, i_llmwcrans_, u_mwcran_, u_mwcrans_, u_lmwcran_, u_lmwcrans, u_llmwcran_, u_llmwcrans_, r_mwcran_, r_mwcrans_, d_mwcran_, d_mwcrans_, smwcran_
Random number shufflers
i_shufrans_, r_shufrans_, d_shufrans_, u_shufrans_
Data conversion
convert_external
Control rounding mode and floating-point exception flags
ieee_flags
Floating-point trap handling
ieee_handler, sigfpe
Show status
ieee_retrospective
Enable/disable nonstandard arithmetic
standard_arithmetic, nonstandard_arithmetic

3.2.2 Optimized Libraries

The libmopt libraries provide alternate versions of some of the functions in libm and libsunmath. Generally, the libmopt versions use different algorithms, and the code is optimized for each of the several different instruction sets corresponding to different hardware platforms. As a result, the functions in libmopt are typically faster than the corresponding functions in libm and libsunmath. Unlike the libm functions, however, which support any of ANSI/POSIX, SVID, X/Open, or C99/IEEE-style treatment of exceptional cases, the libmopt functions only support C99/IEEE-style handling of these cases. (See Standards Compliance.) Also, the libmopt functions may deliver slightly different numerical results than their libm counterparts, and while all mathematical functions in libm deliver results with reasonable accuracy regardless of the floating-point rounding direction mode, the result of calling any function in libmopt with a rounding direction other than round-to-nearest is undefined. A program that uses libmopt must ensure that the default round-to-nearest mode is in effect whenever any standard math function is called.

On Oracle Solaris, the libmopt libraries are provided in two forms, a set of static archives and a shared object. Each static archive contains functions compiled to use a particular instruction set. When a program is linked with libmopt in static archive form, the compiler selects the instruction set variant based on the value of the –xarch option specified at link time, thereby conferring the best performance on hardware platforms to which that instruction set is best suited, but possibly giving suboptimal performance on other platforms. To link with libmopt in static archive form, use the -xlibmopt=archive option.

The shared object form of libmopt contains all of the instruction set variants of each function in a single object. This library uses the Oracle Solaris linker's symbol capability feature to select the most appropriate instruction set at run time based on the hardware platform on which the program is running. Thus, linking with libmopt in shared object form offers good performance on any platform albeit with a risk that the same program may compute slightly different results when run on different platforms due to differences in the instruction sets such as, using fused multiply-add on the systems that support it. To link with libmopt in shared object form, use the -xlibmopt=shared option.


Note -  The shared object form of libmopt is intended to be linked only with an executable program and not with other shared objects. The –xlibmopt option has no effect when creating a shared object using the –G option.

On Linux, the libmopt libraries are only provided as static archives.