expm1
Compute the value of e raised to the power of x and subtract 1 from the result.
Interface Definition
C interface:
float expm1f(float x);
double expm1(double x);
long double expm1l(long double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data. |
Input |
Return Value
- The difference of e raised to the power of x and 1 is returned. y ∈ (-1, +INF)
- If the input is +0, the return value is +0.
- If the input is -0, the return value is +0.
- If the input of expm1f is greater than 0x1.62e42ep6 (about 88.72), the return value is +∞. If the input of expm1 is greater than 0x1.8p9 (768), the return value is +∞.
- If the input of expm1f is less than 0x1.9fe368p6 (about -103.97), the return value is -1.0. If the input of expm1 is less than -0x1.4cb5fp5 (about -41.58), the return value is -1.0.
- If the input is +∞, the return value is +∞.
- If the input is -∞, the return value is -1.0.
- If the input is NaN, the return value is NaN.
Dependency
C: "km.h"
Example
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | // typical usage double x1 = 0.0, x2 = -0.0; double a = 1.0, b = INFINITY, c = -INFINITY, d = NAN, e = 1024.0; // print result printf("expm1(0.0) = %.15f\n", expm1(x1)); printf("expm1(-0.0) = %.15f\n", expm1(x2)); printf("expm1(1024.0) = %.15f\n", expm1(e)); printf("expm1(1.0) = %.15f\n", expm1(a)); printf("expm1(INFINITY) = %.15f\n", expm1(b)); printf("expm1(-INFINITY) = %.15f\n", expm1(c)); printf("expm1(NAN) = %.15f\n", expm1(d)); /* * expm1(0.0) = 0.000000000000000 * expm1(-0.0) = -0.000000000000000 * expm1(1024.0) = inf * expm1(1.0) = 1.718281828459045 * expm1(INFINITY) = inf * expm1(-INFINITY) = -1.000000000000000 * expm1(NAN) = nan * * */ |
Parent topic: Exponential and Logarithmic Functions