Computes exponential, logarithm, and power functions.
IEEE Math Library (libm.a) or System V Math Library (libmsaa.a)
#include <math.h>
double exp ( x)
double x;
float expf (x)
float x;
long double expl (x)
long double x;
_Decimal32 expd32 (x)
_Decimal32 x;
_Decimal64 expd64 (x)
_Decimal64 x;
_Decimal128 expd128 (x)
_Decimal128 x;
These subroutines are used to compute exponential, logarithm, and power functions.
The exp, expf, expl, expd32, expd64, and expd128 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.
Item | Description |
---|---|
x | Specifies some double-precision floating-point value. |
y | Specifies some double-precision floating-point value. |
Upon successful completion, the exp, expf, expl, expd32, expd64, and expd128 subroutines return the exponential value of x.
If the correct value would cause overflow, a range error occurs and the exp, expf, expl, expd32, expd64, and expd128 subroutine returns 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 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.
When using the libm.a library:
Item | Description |
---|---|
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):
Item | Description |
---|---|
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.