exp2()

Computes the power of 2.

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

x

A value from which to compute.

Remarks

These functions returns 2x.

If x is too large, the function sets errno to ERANGE and fpclassify(exp2(x)) does not return FP_NORMAL.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of exp2() Usage

#include <math.h>

#include <stdio.h>

int main(void)

{

double i = 12;

printf("2^%f = %f.\n",i,i, exp2(i));

return 0;

}

Output:

2^(12.000000) = 4096.000000.