Important: The information in this document is obsolete and should not be used for new development.
exp2
You can use theexp2
function to raise 2 to some power.
double_t exp2 (double_t x);
x
- Any floating-point number.
DESCRIPTION
Theexp2
function returns the base 2 exponential of its argument.
The
log2
function performs the inverse operation .EXCEPTIONS
When x is finite and nonzero, the result of might raise the following exceptions:
- inexact (for all finite, nonzero values of x)
- overflow (if the result is outside the range of the data type)
- underflow (if the result is inexact and must be represented as a denormalized number or 0)
SPECIAL CASES
Table 10-8 shows the results when the argument to theexp2
function is a zero, a NaN, or an Infinity.
Special cases for the exp2
functionOperation Result Exceptions raised +1 None +1 None NaN None[29] + None +0 None EXAMPLES
z = exp2(2.0); /* z = 22 = 4. The inexact exception is raised. */ z = exp2(1.5); /* z = 21.5 2.82843. The inexact exception is raised. */
[29] If the NaN is a signaling NaN, the invalid exception is raised.