The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

expm1 - compute exponential functions

 SYNOPSIS



#include <math.h>

double expm1 (double x);

 DESCRIPTION

The expm1() function computes ex-1.0.

 RETURN VALUE

If x is NaN, then the function returns NaN and errno may be set to EDOM.

If x is positive infinity, expm1() returns positive infinity.

If x is negative infinity, expm1() returns -1.0.

If the value overflows, expm1() returns HUGE_VAL and may set errno to ERANGE.

 ERRORS

The expm1() function may fail if:
[EDOM]
The value of x is NaN.
[ERANGE]
The result overflows.

 EXAMPLES

None.

 APPLICATION USAGE

The value of expm1(x) may be more accurate than exp(x)-1.0 for small values of x.

The expm1() and log1p() functions are useful for financial calculations of ((1+x)n-1)/x, namely:

expm1(n * log1p(x))/x
when x is very small (for example, when calculating small daily interest rates). These functions also simplify writing accurate inverse hyperbolic functions.

 FUTURE DIRECTIONS

None.

 SEE ALSO

exp(), ilogb(), log1p(), <math.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]