[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

# Technical Reference: Base Operating System and Extensions, Volume 1

## exp2, exp2f, or exp2l Subroutine

### 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;```

### Description

The exp2, exp2f, and exp2l 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

 x Specifies the base 2 exponential to be computed.

### Return Values

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

If the correct value causes overflow, a range error occurs and the exp2, exp2f, and exp2l subroutines return the value of the macro (HUGE_VAL, HUGE_VALF, and HUGE_VALL, 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.

### Related Information

math.h in AIX 5L Version 5.2 Files Reference.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]