IMF Device Library Logarithmic Functions

The IMF Device Library supports the following logarithmic functions:

ilogb

Description: The ilogb(x) function returns the unbiased exponent of x base-2 as a signed integer value.

Special Values:

Argument x Result ilogb(x)
+/-0 INT_MIN
+/-∞ INT_MAX
S/QNAN INT_MIN

Note

INT_MIN and INT_MAX are minimum and maximum signed integer values.

Calling Interfaces:

Default accuracy:

int       sycl::ext::intel::math::ilogb ( float x );
int       sycl::ext::intel::math::ilogb ( double x );

log

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

Special Values:

Argument x Result log(x)
-∞ QNAN
x < +0 QNAN
+/-0 -∞
+∞ +∞

Useful Identities:

log(x) = log2(x) / log2(e)
log(x) = log10(x) / log10(e)

Calling Interfaces:

log10

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

Special Values:

Argument x Result log10(x)
-∞ QNAN
x < +0 QNAN
+/-0 -∞
+∞ +∞

Useful Identities:

log10(x) = log2(x) / log2(10) log10(x) = log(x) / log(10)

Calling Interfaces:

log1p

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

This function is more accurate than the expression log(x + 1) if x is close to zero, when the (x + 1) result can be rounded to 1 in a target floating-point precision. The log1p(x) function is particularly useful for financial calculations, such as small daily interest rates, using (1+x)^n-1 computed as expm1( n·log1p(x) ).

Special Values:

Argument x Result log1p(x)
-∞ QNAN
x < -1 QNAN
-1 -∞
+/-0 +/-0
+∞ +∞

Useful Identities:

log1p(x) = log(x+1), excepts |x| close to zero

Calling Interfaces:

log2

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

Special Values:

Argument x Result log2(x)
-∞ QNAN
x < +0 QNAN
+/-0 -∞
+∞ +∞

Useful Identities:

log2(x) = log10(x) / log10(2)
log2(x) = log(x) / log(2)

Calling Interfaces:

logb

Description: The logb(x) function returns the unbiased radix-independent signed exponent of x as a floating-point value.

Special Values:

Argument x Result logb(x)
-∞ +∞
+/-0 -∞
+∞ +∞

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::logb ( float x );
double      sycl::ext::intel::math::logb ( double x );