exp2, exp2f, exp2l, exp2d32, exp2d64, and exp2d128 Subroutines

Purpose

Computes the base 2 exponential.

Syntax

#include <math.h>

double exp2 (x)
double x;

float exp2f (x)
float x;

long double exp2l (x)
long double x;
_Decimal32 exp2d32 (x)
_Decimal32 x;

_Decimal64 exp2d64 (x)
_Decimal64 x;

_Decimal128 exp2d128 (x)
_Decimal128 x;

Description

The exp2, exp2f, exp2l, exp2d32, exp2d64, and exp2d128 subroutines compute the base 2 exponential of the x parameter.

An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept (FE_ALL_EXCEPT) before calling these subroutines. On return, if errno is nonzero or fetestexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

Parameters

Item Description
x Specifies the base 2 exponential to be computed.

Return Values

Upon successful completion, the exp2, exp2f, exp2l, exp2d32, exp2d64, or exp2d128 subroutine returns 2x .

If the correct value causes overflow, a range error occurs and the exp2, exp2f, exp2l, exp2d32, exp2d64, and exp2d128 subroutines return the value of the macro (HUGE_VAL, HUGE_VALF, HUGE_VALL, HUGE_VAL_D32, HUGE_VAL_D64, and HUGE_VAL_D128 respectively).

If the correct value causes underflow and is not representable, a range error occurs, and 0.0 is returned.

If x is NaN, NaN is returned.

If x is ±0, 1 is returned.

If x is -Inf, 0 is returned.

If x is +Inf, x is returned.

If the correct value would cause underflow, and is representable, a range error may occur and the correct value is returned.