Developer Guide and Reference

ID 767253
Date 10/31/2024
Public
Document Table of Contents

IMF Device Library Exponential Functions

The IMF Device Library supports the following exponential functions:

exp

Description: The exp(x) function returns e (Euler's number ~2.7182818) raised to the x power: e^x

Special Values:

Argument x Result exp(x)
-∞ +0
x < -OVFL +0
+/-0 +1
x > +OVFL +∞
+∞ +∞
NOTE:
OVFL is overflow/underflow threshold. OVFL = log(MAX) where MAX is maximum floating point normal number for given precision.

Useful Identities:

exp(x) = 2 · tanh( x/2 )/(1 - tanh( x/2 )) + 1
exp(x) = cosh(x) + sinh(x)
exp(x) = exp2( log2(e)·x )>
exp(x) = exp10( log10(e)·x )>

Calling Interfaces:

  • Default accuracy:
    sycl::half  sycl::ext::intel::math::exp ( sycl::half x );
    float       sycl::ext::intel::math::exp ( float x );
    double      sycl::ext::intel::math::exp ( double x );
  • High accuracy (HA):
    sycl::half  sycl::ext::intel::math::ha::exp ( sycl::half x );
    float       sycl::ext::intel::math::ha::exp ( float x );
    double      sycl::ext::intel::math::ha::exp ( double x );
  • Low accuracy (LA):
    sycl::half  sycl::ext::intel::math::la::exp ( sycl::half x );
    double      sycl::ext::intel::math::la::exp ( double x );
  • Enhanced performance:
    sycl::half  sycl::ext::intel::math::ep::exp ( sycl::half x );
    double      sycl::ext::intel::math::ep::exp ( double x );

exp10

Description: The exp10(x) function returns 10 raised to the x power: 10^x.

Special Values:

Argument x Result exp10(x)
-∞ +0
x < -OVFL +0
+/-0 +1
x > +OVFL +∞
+∞ +∞
NOTE:
OVFL is overflow/underflow threshold. OVFL = log10(MAX) where MAX is maximum floating point normal number for given precision.

Useful Identities:

exp10(x) = exp( log(10)·x )
exp10(x) = exp2( log2(10)·x )

Calling Interfaces:

  • Default accuracy:
    float       sycl::ext::intel::math::exp10 ( float x );
    double      sycl::ext::intel::math::exp10 ( double x );
  • High accuracy (HA):
    float       sycl::ext::intel::math::ha::exp10 ( float x );
    double      sycl::ext::intel::math::ha::exp10 ( double x );
  • Low accuracy (LA):
    double      sycl::ext::intel::math::la::exp10 ( double x );
  • Enhanced performance:
    double      sycl::ext::intel::math::ep::exp10 ( double x );

exp2

Description: The exp2(x) function returns 2 raised to the x power: 2^x.

Special Values:

Argument x Result exp2(x)
-∞ +0
x < -OVFL +0
+/-0 +1
x > +OVFL +∞
+∞ +∞
NOTE:
OVFL is overflow/underflow threshold. OVFL = log2(MAX) where MAX is maximum floating point normal number for given precision.

Useful Identities:

exp2(x) = exp( log(2)·x )
exp2(x) = exp10( log10(2)·x )

Calling Interfaces:

  • Default accuracy:
    sycl::half  sycl::ext::intel::math::exp2 ( sycl::half x );
    float       sycl::ext::intel::math::exp2 ( float x );
    double      sycl::ext::intel::math::exp2 ( double x );
  • High accuracy (HA):
    float       sycl::ext::intel::math::ha::exp2 ( float x );
    double      sycl::ext::intel::math::ha::exp2 ( double x );
  • Low accuracy (LA):
    double      sycl::ext::intel::math::la::exp2 ( double x );
  • Enhanced performance:
    double      sycl::ext::intel::math::ep::exp2 ( double x );

expm1

Description: The expm1(x) function returns e (Euler's number ~2.7182818) raised to the x power minus 1: e^x-1.

The value expm1(x) is more accurate than exp(x)-1.0 for small x and does not produce underflows.

This function is particularly useful for financial calculations, such as small daily interest rates, where (1+x)^n-1 is computed as expm1( n·log1p(x) ).

Special Values:

Argument x Result expm1(x)
-∞ -1
+/-0 +0
x > +OVFL +∞
+∞ +∞
NOTE:
OVFL is overflow threshold. OVFL = log(MAX) where MAX is maximum floating point normal number for given precision.

Useful Identities:

expm1(x) = exp(x) - 1
expm1(x) = 2 · tanh( x/2 )/(1 - tanh( x/2 ))

Calling Interfaces:

  • Default accuracy:
    float       sycl::ext::intel::math::expm1 ( float x );
    double      sycl::ext::intel::math::expm1 ( double x );
  • High accuracy (HA):
    float       sycl::ext::intel::math::ha::expm1 ( float x );
    double      sycl::ext::intel::math::ha::expm1 ( double x );
  • Low accuracy (LA):
    float       sycl::ext::intel::math::la::expm1 ( float x );
    double      sycl::ext::intel::math::la::expm1 ( double x );
  • Enhanced performance:
    float       sycl::ext::intel::math::ep::expm1 ( float x );
    double      sycl::ext::intel::math::ep::expm1 ( double x );