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