Computes the power of 2.
#include <math.h> double exp2(double x); float exp2f(float x); long double exp2l(long double x);
x
A value from which to compute.
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.
#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.