1exp(3M) Mathematical Library Functions exp(3M)
2
3
4
6 exp, expf, expl - exponential function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double exp(double x);
13
14
15 float expf(float x);
16
17
18 long double expl(long double x);
19
20
22 These functions compute the base-e exponential of x.
23
25 Upon successful completion, these functions return the exponential
26 value of x.
27
28
29 If the correct value would cause overflow, a range error occurs and
30 exp(), expf(), and expl() return HUGE_VAL, HUGE_VALF, and HUGE_VALL,
31 respectively.
32
33
34 If x is NaN, a NaN is returned.
35
36
37 If x is ±0, 1 is returned.
38
39
40 If x is +Inf, x is returned.
41
42
43 For exceptional cases, matherr(3M) tabulates the values to be returned
44 by exp() as specified by SVID3 and XPG3. See standards(5).
45
47 These functions will fail if:
48
49 Range Error The result overflows.
50
51 If the integer expression (math_errhandling &
52 MATH_ERREXCEPT) is non-zero, the overflow floating-point
53 exception is raised.
54
55 The exp() function sets errno to ERANGE if the result
56 overflows.
57
58
60 An application wanting to check for exceptions should call feclearex‐
61 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
62 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
63 non-zero, an exception has been raised. An application should either
64 examine the return value or check the floating point exception flags to
65 detect exceptions.
66
67
68 An application can also set errno to 0 before calling exp(). On return,
69 if errno is non-zero, an error has occurred. The expf() and expl()
70 functions do not set errno.
71
73 See attributes(5) for descriptions of the following attributes:
74
75
76
77
78 ┌─────────────────────────────┬─────────────────────────────┐
79 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
80 ├─────────────────────────────┼─────────────────────────────┤
81 │Interface Stability │Standard │
82 ├─────────────────────────────┼─────────────────────────────┤
83 │MT-Level │MT-Safe │
84 └─────────────────────────────┴─────────────────────────────┘
85
87 feclearexcept(3M), fetestexcept(3M), isnan(3M), log(3M), math.h(3HEAD),
88 matherr(3M), mp(3MP), attributes(5), standards(5)
89
90
91
92SunOS 5.11 12 Jul 2006 exp(3M)