**[ Bottom of Page | Previous Page | Next Page | Contents | Index | ****Library Home** |
**Legal** |
**Search** ]
# Technical Reference: Base Operating System and Extensions, Volume 1

## exp, expf, or expl Subroutine

### Purpose

Computes exponential, logarithm, and power functions.

### Libraries

IEEE Math Library (libm.a)

or
System V Math Library (libmsaa.a)

### Syntax

#include <math.h>

`double exp ( x)`

double x;

float expf (x)
float x;

long double expl (x)
long double x;

### Description

These subroutines are used to compute exponential, logarithm,
and power functions.

The exp, expf, and expl subroutines returns `exp (x).`

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. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO
| FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.

### Parameters

x |
Specifies some double-precision floating-point value. |

y |
Specifies some double-precision floating-point value. |

### Return Values

Upon successful completion, the exp, expf, and expl subroutines return the exponential
value of x.

If the correct value would cause overflow, a range error occurs and the exp, expf, and expl subroutine returns the value of the macro HUGE_VAL, HUGE_VALF and HUGE_VALL,
respectively.

If the correct value would cause underflow, and is not representable, a
range error may occur, and either 0.0 (if supported), or an implementation-defined
value is returned.

If x is NaN, a 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.

### Error Codes

When using the libm.a library:

exp |
If the correct value would overflow, the exp subroutine
returns a HUGE_VAL value and the errno global variable is set to a ERANGE value. |

When using libmsaa.a(-lmsaa):

exp |
If the correct value would overflow, the exp subroutine
returns a HUGE_VAL value. If the correct value would
underflow, the exp subroutine returns 0. In both cases errno is set to ERANGE. |

expl |
If the correct value would overflow, the expl subroutine
returns a HUGE_VAL value. If the correct value would
underflow, the expl subroutine returns 0. In both cases errno is set to ERANGE. |

expl |
If the correct value overflows, the expl subroutine
returns a HUGE_VAL value and errno is set to ERANGE. |

These error-handling procedures may be changed with
the matherr subroutine when using the libmsaa.a library.

### Related Information

feclearexcept Subroutine, fetestexcept Subroutine, and class, _class, finite, isnan, or unordered Subroutines.

The matherr (matherr Subroutine)subroutine, sinh, cosh,
or tanh subroutine.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

128-Bit long double Floating-Point
Format in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

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

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