1EXP(P) POSIX Programmer's Manual EXP(P)
2
3
4
6 exp, expf, expl - exponential function
7
9 #include <math.h>
10
11 double exp(double x);
12 float expf(float x);
13 long double expl(long double x);
14
15
17 These functions shall compute the base- e exponential of x.
18
19 An application wishing to check for error situations should set errno
20 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
21 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID
22 | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
23 occurred.
24
26 Upon successful completion, these functions shall return the exponen‐
27 tial value of x.
28
29 If the correct value would cause overflow, a range error shall occur
30 and exp(), expf(), and expl() shall return the value of the macro
31 HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively.
32
33 If the correct value would cause underflow, and is not representable, a
34 range error may occur, and either 0.0 (if supported), or an imple‐
35 mentation-defined value shall be returned.
36
37 If x is NaN, a NaN shall be returned.
38
39 If x is ±0, 1 shall be returned.
40
41 If x is -Inf, +0 shall be returned.
42
43 If x is +Inf, x shall be returned.
44
45 If the correct value would cause underflow, and is representable, a
46 range error may occur and the correct value shall be returned.
47
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 result underflows.
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
74 None.
75
77 Note that for IEEE Std 754-1985 double, 709.8 < x implies exp( x) has
78 overflowed. The value x < -708.4 implies exp( x) has underflowed.
79
80 On error, the expressions (math_errhandling & MATH_ERRNO) and
81 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
82 at least one of them must be non-zero.
83
85 None.
86
88 None.
89
91 feclearexcept() , fetestexcept() , isnan() , log() , the Base Defini‐
92 tions volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error
93 Conditions for Mathematical Functions, <math.h>
94
96 Portions of this text are reprinted and reproduced in electronic form
97 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
98 -- Portable Operating System Interface (POSIX), The Open Group Base
99 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
100 Electrical and Electronics Engineers, Inc and The Open Group. In the
101 event of any discrepancy between this version and the original IEEE and
102 The Open Group Standard, the original IEEE and The Open Group Standard
103 is the referee document. The original Standard can be obtained online
104 at http://www.opengroup.org/unix/online.html .
105
106
107
108IEEE/The Open Group 2003 EXP(P)