Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference
A newer version of this document is available. Customers should click here to go to the newest version.
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 |
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:
- Default accuracy:
sycl::half sycl::ext::intel::math::log ( sycl::half x ); float sycl::ext::intel::math::log ( float x ); double sycl::ext::intel::math::log ( double x );
- High accuracy (HA):
float sycl::ext::intel::math::ha::log ( float x ); double sycl::ext::intel::math::ha::log ( double x );
- Low accuracy (LA):
float sycl::ext::intel::math::la::log ( float x ); double sycl::ext::intel::math::la::log ( double x );
- Enhanced performance:
float sycl::ext::intel::math::ep::log ( float x ); double sycl::ext::intel::math::ep::log ( double x );
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:
- Default accuracy:
sycl::half sycl::ext::intel::math::log10 ( sycl::half x ); float sycl::ext::intel::math::log10 ( float x ); double sycl::ext::intel::math::log10 ( double x );
- High accuracy (HA):
float sycl::ext::intel::math::ha::log10 ( float x ); double sycl::ext::intel::math::ha::log10 ( double x );
- Low accuracy (LA):
float sycl::ext::intel::math::la::log10 ( float x ); double sycl::ext::intel::math::la::log10 ( double x );
- Enhanced performance:
float sycl::ext::intel::math::ep::log10 ( float x );
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:
- Default accuracy:
float sycl::ext::intel::math::log1p ( float x ); double sycl::ext::intel::math::log1p ( double x );
- High accuracy (HA):
float sycl::ext::intel::math::ha::log1p ( float x ); double sycl::ext::intel::math::ha::log1p ( double x );
- Low accuracy (LA):
float sycl::ext::intel::math::la::log1p ( float x ); double sycl::ext::intel::math::la::log1p ( double x );
- Enhanced performance:
float sycl::ext::intel::math::ep::log1p ( float x );
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:
- Default accuracy:
sycl::half sycl::ext::intel::math::log2 ( sycl::half x ); float sycl::ext::intel::math::log2 ( float x ); double sycl::ext::intel::math::log2 ( double x );
- High accuracy (HA):
float sycl::ext::intel::math::ha::log2 ( float x ); double sycl::ext::intel::math::ha::log2 ( double x );
- Low accuracy (LA):
float sycl::ext::intel::math::la::log2 ( float x ); double sycl::ext::intel::math::la::log2 ( double x );
- Enhanced performance:
float sycl::ext::intel::math::ep::log2 ( float x );
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 );