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
21

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

74       None.
75

APPLICATION USAGE

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

RATIONALE

98       None.
99

FUTURE DIRECTIONS

101       None.
102

SEE ALSO

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