exp2, exp2f, exp2l

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
exp2
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
Types
(C99)(C99)
Macro constants
 
Defined in header <math.h>
float       exp2f( float n );
(1) (since C99)
double      exp2( double n );
(2) (since C99)
long double exp2l( long double n );
(3) (since C99)
Defined in header <tgmath.h>
#define exp2( n )
(4) (since C99)
1-3) Computes 2 raised to the given power n.
4) Type-generic macro: If n has type long double, exp2l is called. Otherwise, if n has integer type or the type double, exp2 is called. Otherwise, exp2f is called.

Parameters

n - floating point value

Return value

If no errors occur, the base-2 exponential of n (2n
) is returned.

If a range error due to overflow occurs, +HUGE_VAL, +HUGE_VALF, or +HUGE_VALL is returned.

If a range error occurs due to underflow, the correct result (after rounding) is returned.

Error handling

Errors are reported as specified in math_errhandling.

If the implementation supports IEEE floating-point arithmetic (IEC 60559),

  • If the argument is ±0, 1 is returned
  • If the argument is -∞, +0 is returned
  • If the argument is +∞, +∞ is returned
  • If the argument is NaN, NaN is returned