Next: expm1, Previous: exp10, Up: Math [Contents][Index]

### 1.17 `exp2`, `exp2f`—exponential, base 2

Synopsis

    #include <math.h>
    double exp2(double x);
    float exp2f(float x);

Description
`exp2` and `exp2f` calculate 2 ^ x, that is, 2 raised to the power x.

You can use the (non-ANSI) function `matherr` to specify error handling for these functions.

Returns
On success, `exp2` and `exp2f` return the calculated value. If the result underflows, the returned value is `0`. If the result overflows, the returned value is `HUGE_VAL`. In either case, `errno` is set to `ERANGE`.

Portability
ANSI C, POSIX.