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

PROLOG

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

NAME

12       expm1, expm1f, expm1l — compute exponential functions
13

SYNOPSIS

15       #include <math.h>
16
17       double expm1(double x);
18       float expm1f(float x);
19       long double expm1l(long double x);
20

DESCRIPTION

22       The functionality described on this reference page is aligned with  the
23       ISO C  standard.  Any  conflict between the requirements described here
24       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
25       defers to the ISO C standard.
26
27       These functions shall compute ex-1.0.
28
29       An  application  wishing to check for error situations should set errno
30       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
31       functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
32       FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero,  an  error  has
33       occurred.
34

RETURN VALUE

36       Upon successful completion, these functions return ex-1.0.
37
38       If  the  correct  value would cause overflow, a range error shall occur
39       and expm1(), expm1f(), and expm1l() shall return the value of the macro
40       HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.
41
42       If x is NaN, a NaN shall be returned.
43
44       If x is ±0, ±0 shall be returned.
45
46       If x is -Inf, -1 shall be returned.
47
48       If x is +Inf, x shall be returned.
49
50       If x is subnormal, a range error may occur
51       and x should be returned.
52
53       If  x  is not returned, expm1(), expm1f(), and expm1l() shall return an
54       implementation-defined value no  greater  in  magnitude  than  DBL_MIN,
55       FLT_MIN, and LDBL_MIN, respectively.
56

ERRORS

58       These functions shall fail if:
59
60       Range Error The result overflows.
61
62                   If  the  integer expression (math_errhandling & MATH_ERRNO)
63                   is non-zero, then errno shall be set to [ERANGE].   If  the
64                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
65                   non-zero, then the overflow floating-point exception  shall
66                   be raised.
67
68       These functions may fail if:
69
70       Range Error The value of x is subnormal.
71
72                   If  the  integer expression (math_errhandling & MATH_ERRNO)
73                   is non-zero, then errno shall be set to [ERANGE].   If  the
74                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
75                   non-zero, then the underflow floating-point exception shall
76                   be raised.
77
78       The following sections are informative.
79

EXAMPLES

81       None.
82

APPLICATION USAGE

84       The  value  of  expm1(x) may be more accurate than exp(x)-1.0 for small
85       values of x.
86
87       The expm1() and log1p() functions are useful for financial calculations
88       of ((1+x)n-1)/x, namely:
89
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       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
98       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
99       at least one of them must be non-zero.
100

RATIONALE

102       None.
103

FUTURE DIRECTIONS

105       None.
106

SEE ALSO

108       exp(), feclearexcept(), fetestexcept(), ilogb(), log1p()
109
110       The Base Definitions volume of POSIX.1‐2017, Section 4.20, Treatment of
111       Error Conditions for Mathematical Functions, <math.h>
112
114       Portions of this text are reprinted and reproduced in  electronic  form
115       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
116       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
117       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
118       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
119       event of any discrepancy between this version and the original IEEE and
120       The Open Group Standard, the original IEEE and The Open Group  Standard
121       is  the  referee document. The original Standard can be obtained online
122       at http://www.opengroup.org/unix/online.html .
123
124       Any typographical or formatting errors that appear  in  this  page  are
125       most likely to have been introduced during the conversion of the source
126       files to man page format. To report such errors,  see  https://www.ker
127       nel.org/doc/man-pages/reporting_bugs.html .
128
129
130
131IEEE/The Open Group                  2017                            EXPM1(3P)
Impressum