1expm1(3M) Mathematical Library Functions expm1(3M)
2
3
4
6 expm1, expm1f, expm1l - compute exponential function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double expm1(double x);
13
14
15 float expm1f(float x);
16
17
18 long double expm1l(long double x);
19
20
22 These functions compute e^x−1.0.
23
25 Upon successful completion, these functions return e^x−1.0.
26
27
28 If x is NaN, a NaN is returned.
29
30
31 If x is ±0, ±0 is returned.
32
33
34 If x is −Inf, −1 is returned.
35
36
37 If x is +Inf, x is returned.
38
40 These functions will fail if:
41
42 Range Error The result overflows.
43
44 If the integer expression (math_errhandling &
45 MATH_ERREXCEPT) is non-zero, the overflow floating-point
46 exception is raised.
47
48
50 The value of expm1(x) can be more accurate than exp(x)−1.0 for small
51 values of x.
52
53
54 The expm1() and log1p(3M) functions are useful for financial calcula‐
55 tions of ((1+x)^n−1)/x, namely:
56
57 expm1(n * log1p(x))/x
58
59
60
61 when x is very small (for example, when performing calculations with a
62 small daily interest rate). These functions also simplify writing
63 accurate inverse hyperbolic functions.
64
65
66 An application wanting to check for exceptions should call feclearex‐
67 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
68 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
69 non-zero, an exception has been raised. An application should either
70 examine the return value or check the floating point exception flags to
71 detect exceptions.
72
74 See attributes(5) for descriptions of the following attributes:
75
76
77
78
79 ┌─────────────────────────────┬─────────────────────────────┐
80 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
81 ├─────────────────────────────┼─────────────────────────────┤
82 │Interface Stability │Standard │
83 ├─────────────────────────────┼─────────────────────────────┤
84 │MT-Level │MT-Safe │
85 └─────────────────────────────┴─────────────────────────────┘
86
88 exp(3M), feclearexcept(3M), fetestexcept(3M), ilogb(3M), log1p(3M),
89 math.h(3HEAD), attributes(5), standards(5)
90
91
92
93SunOS 5.11 12 Jul 2006 expm1(3M)