1EXPM1(3P) POSIX Programmer's Manual EXPM1(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 expm1, expm1f, expm1l — compute exponential functions
14
16 #include <math.h>
17
18 double expm1(double x);
19 float expm1f(float x);
20 long double expm1l(long double x);
21
23 The functionality described on this reference page is aligned with the
24 ISO C standard. Any conflict between the requirements described here
25 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
26 defers to the ISO C standard.
27
28 These functions shall compute ex−1.0.
29
30 An application wishing to check for error situations should set errno
31 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
32 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
33 FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
34 occurred.
35
37 Upon successful completion, these functions return ex−1.0.
38
39 If the correct value would cause overflow, a range error shall occur
40 and expm1(), expm1f(), and expm1l() shall return the value of the macro
41 HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.
42
43 If x is NaN, a NaN shall be returned.
44
45 If x is ±0, ±0 shall be returned.
46
47 If x is −Inf, −1 shall be returned.
48
49 If x is +Inf, x shall be returned.
50
51 If x is subnormal, a range error may occur
52 and x should be returned.
53
54 If x is not returned, expm1(), expm1f(), and expm1l() shall return an
55 implementation-defined value no greater in magnitude than DBL_MIN,
56 FLT_MIN, and LDBL_MIN, respectively.
57
59 These functions shall fail if:
60
61 Range Error The result overflows.
62
63 If the integer expression (math_errhandling & MATH_ERRNO)
64 is non-zero, then errno shall be set to [ERANGE]. If the
65 integer expression (math_errhandling & MATH_ERREXCEPT) is
66 non-zero, then the overflow floating-point exception shall
67 be raised.
68
69 These functions may fail if:
70
71 Range Error The value of x is subnormal.
72
73 If the integer expression (math_errhandling & MATH_ERRNO)
74 is non-zero, then errno shall be set to [ERANGE]. If the
75 integer expression (math_errhandling & MATH_ERREXCEPT) is
76 non-zero, then the underflow floating-point exception shall
77 be raised.
78
79 The following sections are informative.
80
82 None.
83
85 The value of expm1(x) may be more accurate than exp(x)−1.0 for small
86 values of x.
87
88 The expm1() and log1p() functions are useful for financial calculations
89 of ((1+x)n−1)/x, namely:
90
91 expm1(n * log1p(x))/x
92
93 when x is very small (for example, when calculating small daily inter‐
94 est rates). These functions also simplify writing accurate inverse
95 hyperbolic functions.
96
97 For IEEE Std 754‐1985 double, 709.8 < x implies expm1(x) has over‐
98 flowed.
99
100 On error, the expressions (math_errhandling & MATH_ERRNO) and
101 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
102 at least one of them must be non-zero.
103
105 None.
106
108 None.
109
111 exp(), feclearexcept(), fetestexcept(), ilogb(), log1p()
112
113 The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
114 Error Conditions for Mathematical Functions, <math.h>
115
117 Portions of this text are reprinted and reproduced in electronic form
118 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
119 -- Portable Operating System Interface (POSIX), The Open Group Base
120 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
121 cal and Electronics Engineers, Inc and The Open Group. (This is
122 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
123 event of any discrepancy between this version and the original IEEE and
124 The Open Group Standard, the original IEEE and The Open Group Standard
125 is the referee document. The original Standard can be obtained online
126 at http://www.unix.org/online.html .
127
128 Any typographical or formatting errors that appear in this page are
129 most likely to have been introduced during the conversion of the source
130 files to man page format. To report such errors, see https://www.ker‐
131 nel.org/doc/man-pages/reporting_bugs.html .
132
133
134
135IEEE/The Open Group 2013 EXPM1(3P)