1EXPM1(P)                   POSIX Programmer's Manual                  EXPM1(P)
2
3
4

NAME

6       expm1, expm1f, expm1l - compute exponential functions
7

SYNOPSIS

9       #include <math.h>
10
11       double expm1(double x);
12       float expm1f(float x);
13       long double expm1l(long double x);
14
15

DESCRIPTION

17       These functions shall compute e**x-1.0.
18
19       An  application  wishing to check for error situations should set errno
20       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
21       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
22       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
23       occurred.
24

RETURN VALUE

26       Upon successful completion, these functions return e**x-1.0.
27
28       If  the  correct  value would cause overflow, a range error shall occur
29       and expm1(), expm1f(), and expm1l() shall return the value of the macro
30       HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.
31
32       If x is NaN, a NaN shall be returned.
33
34       If x is ±0, ±0 shall be returned.
35
36       If x is -Inf, -1 shall be returned.
37
38       If x is +Inf, x shall be returned.
39
40       If x is subnormal, a range error may occur and x should be returned.
41

ERRORS

43       These functions shall fail if:
44
45       Range Error
46              The result overflows.
47
48       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
49       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
50       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then the overflow
51       floating-point exception shall be raised.
52
53
54       These functions may fail if:
55
56       Range Error
57              The value of x is subnormal.
58
59       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
60       then  errno  shall  be  set  to  [ERANGE].  If  the  integer expression
61       (math_errhandling & MATH_ERREXCEPT) is  non-zero,  then  the  underflow
62       floating-point exception shall be raised.
63
64
65       The following sections are informative.
66

EXAMPLES

68       None.
69

APPLICATION USAGE

71       The  value  of  expm1(x) may be more accurate than exp(x)-1.0 for small
72       values of x.
73
74       The expm1() and log1p() functions are useful for financial calculations
75       of ((1+x)**n-1)/x, namely:
76
77
78              expm1(n * log1p(x))/x
79
80       when  x is very small (for example, when calculating small daily inter‐
81       est rates). These functions  also  simplify  writing  accurate  inverse
82       hyperbolic functions.
83
84       For  IEEE Std 754-1985  double,  709.8  < x implies expm1( x) has over‐
85       flowed.
86
87       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
88       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
89       at least one of them must be non-zero.
90

RATIONALE

92       None.
93

FUTURE DIRECTIONS

95       None.
96

SEE ALSO

98       exp() , feclearexcept() , fetestexcept() , ilogb() , log1p() , the Base
99       Definitions  volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of
100       Error Conditions for Mathematical Functions, <math.h>
101
103       Portions of this text are reprinted and reproduced in  electronic  form
104       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
105       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
106       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
107       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
108       event of any discrepancy between this version and the original IEEE and
109       The Open Group Standard, the original IEEE and The Open Group  Standard
110       is  the  referee document. The original Standard can be obtained online
111       at http://www.opengroup.org/unix/online.html .
112
113
114
115IEEE/The Open Group                  2003                             EXPM1(P)
Impressum