Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Exponential Functions

Many routines in the Intel® oneAPI DPC++/C++ Compiler Math Library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

The mathimf.h header file includes prototypes for Intel® oneAPI DPC++/C++ Compiler Math Library functions.

The math library supports the following exponential functions:

NOTE:

FP16 Math Functions have the following requirements:

  • Version 2021.4 or higher of the Intel® oneAPI DPC++/C++ Compiler.

  • A next-generation Intel® Xeon® Scalable processor, code name Sapphire Rapids.

cbrt

Description: The cbrt function returns the cube root of x.

Calling interface:
double cbrt(double x);
long double cbrtl(long double x);
float cbrtf(float x);
_Float16 cbrtf16(_Float16 x);

exp

Description: The exp function returns e raised to the x power, ex.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double exp(double x);
long double expl(long double x);
float expf(float x);
_Float16 expf16(_Float16 x);

exp10

Description: The exp10 function returns 10 raised to the x power, 10x.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double exp10(double x);
long double exp10l(long double x);
float exp10f(float x);
_Float16 exp10f16(_Float16 x);

exp2

Description: The exp2 function returns 2 raised to the x power, 2x.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double exp2(double x);
long double exp2l(long double x);
float exp2f(float x);
_Float16 exp2f16(_Float16 x);

expm1

Description: The expm1 function returns e raised to the x power, minus 1, ex -1.

errno: ERANGE, for overflow conditions

Calling interface:
double expm1(double x);
long double expm1l(long double x);
float expm1f(float x);
_Float16 expm1f16(_Float16 x);

frexp

Description: The frexp function converts a floating-point number x into signed normalized fraction in [1/2, 1) multiplied by an integral power of two. The signed normalized fraction is returned, and the integer exponent stored at location exp.

Calling interface:
double frexp(double x, int *exp);
long double frexpl(long double x, int *exp);
float frexpf(float x, int *exp);
_Float16 frexpf16(_Float16 x, int *exp);

hypot

Description: The hypot function returns the square root of (x2 + y2).

errno: ERANGE, for overflow conditions

Calling interface:
double hypot(double x, double y);
long double hypotl(long double x, long double y);
float hypotf(float x, float y);
_Float16 hypotf16(_Float16 x, _Float16 y);

ilogb

Description: The ilogb function returns the exponent of x base two as a signed int value.

errno: ERANGE, for x = 0

Calling interface:
int ilogb(double x);
int ilogbl(long double x);
int ilogbf(float x);
int ilogbf16(_Float16 x);

invsqrt

Description: The invsqrt function returns the inverse square root.

Calling interface:
double invsqrt(double x);
long double invsqrtl(long double x);
float invsqrtf(float x);
_Float16 invsqrtf16(_Float16 x);

ldexp

Description: The ldexp function returns x*2exp, where exp is an integer value.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double ldexp(double x, int exp);
long double ldexpl(long double x, int exp);
float ldexpf(float x, int exp);
_Float16 ldexpf16(_Float16 x, int exp);

log

Description: The log function returns the natural log of x, ln(x).

errno: EDOM, for x < 0
errno: ERANGE, for x = 0

Calling interface:
double log(double x);
long double logl(long double x);
float logf(float x);
_Float16 logf16(_Float16 x);

log10

Description: The log10 function returns the base-10 log of x, log10(x).

errno: EDOM, for x < 0
errno: ERANGE, for x = 0

Calling interface:
double log10(double x);
long double log10l(long double x);
float log10f(float x);
_Float16 log10f16(_Float16 x);

log1p

Description: The log1p function returns the natural log of (x+1), ln(x + 1).

errno: EDOM, for x < -1
errno: ERANGE, for x = -1

Calling interface:
double log1p(double x);
long double log1pl(long double x);
float log1pf(float x);
_Float16 log1pf16(_Float16 x);

log2

Description: The log2 function returns the base-2 log of x, log2(x).

errno: EDOM, for x < 0
errno: ERANGE, for x = 0

Calling interface:
double log2(double x);
long double log2l(long double x);
float log2f(float x);
_Float16 log2f16(_Float16 x);

logb

Description: The logb function returns the signed exponent of x.

errno: EDOM, for x = 0

Calling interface:
double logb(double x);
long double logbl(long double x);
float logbf(float x);
_Float16 logbf16(_Float16 x);

pow

Description: The pow function returns x raised to the power of y, xy.

errno: EDOM, for x = 0 and y < 0
errno: EDOM, for x < 0 and y is a non-integer
errno: ERANGE, for overflow and underflow conditions

Calling interface:
double pow(double x, double y);
long double powl(double x, double y);
float powf(float x, float y);
_Float16 powf16(_Float16 x, _Float16 y);

pow2o3

Description: The pow2o3 function returns the cube root of x squared, cbrt(x2).

Calling interface:
double pow2o3(double x);
float pow2o3f(float x);
_Float16 pow2o3f16(_Float16 x);

pow3o2

Description: The pow3o2 function returns the square root of the cube of x, sqrt(x3).

errno: EDOM, for x < 0
errno: ERANGE, for overflow and underflow conditions

Calling interface:
double pow3o2(double x);
float pow3o2f(float x);
_Float16 pow3o2f16(_Float16 x);

powr

Description: The powr function returns x raised to the power of y, xy, where x ≥ 0.

errno: EDOM, for x < 0
errno: ERANGE, for overflow and underflow conditions

Calling interface:
double powr(double x, double y);
float powrf(float x, float y);
_Float16 powrf16(_Float16 x, _Float16 y);

scalb

Description: The scalb function returns x*2y, where y is a floating-point value.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double scalb(double x, double y);
long double scalbl(long double x, long double y);
float scalbf(float x, float y);
_Float16 scalbf16(_Float16 x, _Float16 y);

scalbn

Description: The scalbn function returns x*2n, where n is an integer value.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double scalbn(double x, int n);
long double scalbnl (long double x, int n);
float scalbnf(float x, int n);
_Float16 scalbnf16(_Float16 x, int n);

scalbln

Description: The scalbln function returns x*2n, where n is a long integer value.

errno: ERANGE, for underflow and overflow conditions

Calling interface:
double scalbln(double x, long int n);
long double scalblnl (long double x, long int n);
float scalblnf(float x, long int n);
_Float16 scalblnf16(_Float16 x, long int n);

sqrt

Description: The sqrt function returns the correctly rounded square root.

errno: EDOM, for x < 0

Calling interface:
double sqrt(double x);
long double sqrtl(long double x);
float sqrtf(float x);
_Float16 sqrtf16(_Float16 x);