function
<cmath> <ctgmath>
exp2
     double exp2  (double x);
      float exp2f (float x);
long double exp2l (long double x);
 
     double exp2 (double x);
      float exp2 (float x);
long double exp2 (long double x);
     double exp2 (T x);           // additional overloads for integral types
 
 
Compute binary exponential function
Returns the base-2 exponential function of x, which is 2 raised to the power x: 2x.
Header 
<tgmath.h> provides a type-generic macro version of this function.
Additional overloads are provided in this header (
<cmath>) for the 
integral types: These overloads effectively cast 
x to a 
double before calculations (defined for 
T being any 
integral type).
 
 
Parameters
- x
- Value of the exponent.
Example
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 
 | /* exp2 example */
#include <stdio.h>      /* printf */
#include <math.h>       /* exp2 */
int main ()
{
  double param, result;
  param = 8.0;
  result = exp2 (param);
  printf ("2 ^ %f = %f.\n", param, result );
  return 0;
}
 | 
Output:
| 
2 ^ 8.000000 is 256.000000.
 | 
See also
- log2
- Compute binary logarithm (function
)
- pow
- Raise to power (function
)
- exp
- Compute exponential function (function
)