Important: The information in this document is obsolete and should not be used for new development.
expm1
You can use theexpm1
function to raise e to some power and subtract 1.
double_t expm1 (double_t x);
x
- Any floating-point number.
DESCRIPTION
Theexpm1
function returns the natural exponential decreased by 1.
For small numbers, use the function call
expm1(x)
instead of the expression
exp(x) - 1The callexpm1(x)
produces a more exact result because it avoids the roundoff error that might occur when the expression is computed.EXCEPTIONS
When x is finite and nonzero, the result of might raise the following exceptions:
- inexact (for all finite, nonzero values of x)
- overflow (if the result is outside the range of the data type)
- underflow (if the result is inexact and must be represented as a denormalized number or 0)
SPECIAL CASES
Table 10-9 shows the results when the argument to theexpm1
function is a zero, a NaN, or an Infinity.
Special cases for the expm1
functionOperation Result Exceptions raised +0 None -0 None NaN None[30] + None -1 None EXAMPLES
z = expm1(-2.1); /* z = e-2.1 - 1 = -0.877544. The inexact exception is raised. */ z = expm1(6); /* z = e6 - 1 = 402.429. The inexact exception is raised. */
[30] If the NaN is a signaling NaN, the invalid exception is raised.