Partager via


exp2, exp2f, exp2l

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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

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

Syntax

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  
);  
  

Parameters

[in] x
The value of the exponent.

Return Value

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

Issue Return
x = ±0 1
x = -INFINITY +0
x = +INFINITY +INFINITY
x = NaN NaN
Overflow range error +HUGE_VAL, +HUGE_VALF, or +HUGE_VALL
Underflow range error correct result, after rounding

Errors are reported as specified in _matherr.

Remarks

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.

Requirements

Routine C header C++ header
exp, expf, expl <math.h> <cmath>

For additional compatibility information, see Compatibility.

See Also

Alphabetical Function Reference
exp, expf
log2, log2f, log2l