# exp2l Function

Calculates the base 2 exponential function of x (2x, where x is a long double precision floating-point value).

Include

<math.h>

Prototype

long double exp2l(long double x);

Argument

 x value for which to return the exponential

Return Value

Returns 2x.

Remarks

A range error occurs if the magnitude of x is too large, and errno will be set to ERANGE.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <math.h>
#include <stdio.h>
#include <errno.h>

int main(void)
{
long double x, y;

errno = 0;
x = 1.0;
y = exp2l(x);
if (errno)
perror("Error");
printf("The base 2 exponential of %Lf is %Lf\n", x, y);

errno = 0;
x = 10;
y = exp2l(x);
if (errno)
perror("Error");
printf("The base 2 exponential of %Lf is %Lf\n", x, y);

errno = 0;
x = -10;
y = exp2l(x);
if (errno)
perror("Error");
printf("The base 2 exponential of %Lf is %Lf\n", x, y);
}

Example Output

The base 2 exponential of 1.000000 is 2.000000
The base 2 exponential of 10.000000 is 1024.000000
The base 2 exponential of -10.000000 is 0.000977