1EXP(3P) POSIX Programmer's Manual EXP(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
12 exp, expf, expl - exponential function
13
15 #include <math.h>
16
17 double exp(double x);
18 float expf(float x);
19 long double expl(long double x);
20
21
23 These functions shall compute the base- e exponential of x.
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
32 Upon successful completion, these functions shall return the exponen‐
33 tial value of x.
34
35 If the correct value would cause overflow, a range error shall occur
36 and exp(), expf(), and expl() shall return the value of the macro
37 HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.
38
39 If the correct value would cause underflow, and is not representable, a
40 range error may occur, and either 0.0 (if supported), or an implemen‐
41 tation-defined value shall be returned.
42
43 If x is NaN, a NaN shall be returned.
44
45 If x is ±0, 1 shall be returned.
46
47 If x is -Inf, +0 shall be returned.
48
49 If x is +Inf, x shall be returned.
50
51 If the correct value would cause underflow, and is representable, a
52 range error may occur and the correct value shall be returned.
53
55 These functions shall fail if:
56
57 Range Error
58 The result overflows.
59
60 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
61 then errno shall be set to [ERANGE]. If the integer expression
62 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the overflow
63 floating-point exception shall be raised.
64
65
66 These functions may fail if:
67
68 Range Error
69 The result underflows.
70
71 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
72 then errno shall be set to [ERANGE]. If the integer expression
73 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow
74 floating-point exception shall be raised.
75
76
77 The following sections are informative.
78
80 None.
81
83 Note that for IEEE Std 754-1985 double, 709.8 < x implies exp( x) has
84 overflowed. The value x < -708.4 implies exp( x) has underflowed.
85
86 On error, the expressions (math_errhandling & MATH_ERRNO) and
87 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
88 at least one of them must be non-zero.
89
91 None.
92
94 None.
95
97 feclearexcept(), fetestexcept(), isnan(), log(), the Base Definitions
98 volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error Condi‐
99 tions for Mathematical Functions, <math.h>
100
102 Portions of this text are reprinted and reproduced in electronic form
103 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
104 -- Portable Operating System Interface (POSIX), The Open Group Base
105 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
106 Electrical and Electronics Engineers, Inc and The Open Group. In the
107 event of any discrepancy between this version and the original IEEE and
108 The Open Group Standard, the original IEEE and The Open Group Standard
109 is the referee document. The original Standard can be obtained online
110 at http://www.opengroup.org/unix/online.html .
111
112
113
114IEEE/The Open Group 2003 EXP(3P)