Rate This Document
Findability
Accuracy
Completeness
Readability

Migration from Libm, Mathlib, and Libimf to KML_MATH

Replaceability

Table 1 Mapping between Libm, Mathlib, and Libimf

Interface

KML Interface

Data Type

Description

sin

sin

double, float, long double

Sine function

cos

cos

double, float, long double

Cosine function

sincos

sincos

double, float, long double

Sincos function

tan

tan

double, float, long double

Tangent function

asin

asin

double, float

Arcsine function

asind

asind

double, float

Arcsine function (angle as the input)

acos

acos

double, float

Arccosine function

atan

atan

double, float

Arctangent function

atan2

atan2

double, float, long double

Arctangent function

cosd

cosd

double, float, long double

Cosine function (angle as the input)

sinh

sinh

double, float

Hyperbolic sine function

cosh

cosh

double, float

Hyperbolic cosine function

tanh

tanh

double, float

Hyperbolic tangent function

asinh

asinh

double, float

Inverse hyperbolic sine function

acosh

acosh

double, float

Inverse hyperbolic cosine function

atanh

atanh

double, float

Inverse hyperbolic tangent function

exp

exp

double, float, long double

Exponential function (base e)

exp2

exp2

double, float

Exponential function (base 2)

log

log

double, float, long double

Logarithmic function (base e)

log2

log2

double, float

Logarithm function (base 2)

log10

log10

double, float

Logarithm function (base 10)

pow

pow

double, float, long double

Power function

sqrt

sqrt

double, float, long double

Square root function

cbrt

cbrt

double, float

Cubic root function

fmod

fmod

double, float

Floating-point modulo

tgamma

tgamma

double, float

Gamma function

__powr8i4

powr8i4

-

80-bit extended-precision power function

Migrating the C-based Library with High-Performance Function Interfaces

  1. Check whether the source code contains the header file <mathimf.h>/<math.h> /<mathlib.h> of the open-source basic math library.
  2. Replace the open-source header file with <km.h>.
  3. In the compilation options, replace -lm or -lmathlib with -lkm -lm.
  4. Add environment variables. /PATH_TO_KM indicates the installation path.
    export LD_LIBRARY_PATH=/PATH_TO_KM:$LD_LIBRARY_PATH

Migrating the C-based Library with High-Precision Function Interfaces

  1. Check whether the source code contains the header file <mathimf.h>/<math.h> of the open-source basic math library.
  2. Replace the open-source header file with <km.h>.
  3. In the compilation options, replace -lm -fp-model=precise with -lkm_l9 -lm.
  4. Add environment variables. /PATH_TO_KM indicates the installation path.
    export LD_LIBRARY_PATH=/PATH_TO_KM:$LD_LIBRARY_PATH