The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

exp2, exp2f, exp2l

Visual Studio 2015

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at exp2, exp2f, exp2l.

Computes 2 raised to the specified value (ie, 2ˣ ).

double exp2(  
   double x  
float exp2(  
   float x  
);  // C++ only  
long double exp2(  
   long double x  
); // C++ only  
float exp2f(  
   float x  
long double exp2l(  
   long double x  


[in] x
The value of the exponent.

If successful, returns the base-2 exponent of x (2ˣ) . Otherwise, may return one of the following values:

x = ±01
x = NaNNaN
Overflow range error+HUGE_VAL, +HUGE_VALF, or +HUGE_VALL
Underflow range errorcorrect result, after rounding

Errors are reported as specified in _matherr.

Because C++ allows overloading, you can call overloads of exp2 that take and return float and long double types. In a C program, exp2 always takes and returns a double.

RoutineC headerC++ header
exp, expf, expl<math.h><cmath>

For additional compatibility information, see Compatibility.

Alphabetical Function Reference
exp, expf
log2, log2f, log2l