exp()

NAME

exp(), expm1(), log(), log10(), log1p(), pow() - exponential, logarithm, power functions

SYNOPSIS

#include <math.h>

double exp (double x) double expm1 (double x) double log (double x) double log10 (double x) double log1p (double x) double pow (double x, double y)

DESCRIPTION

The exp(3) function computes the exponential value of the given argument x.

The expm1(3) function computes the value exp(x)-1 accurately even for tiny argument x.

The log(3) function computes the value for the natural logarithm of the argument x.

The log10(3) function computes the value for the logarithm of argument x to base 10.

The log1p(3) function computes the value of log(1+x) accurately even for tiny argument x.

The pow(3) computes the value of x to the exponent y.

ERROR (due to Roundoff etc.)

The functions exp(x), expm1(x) and log1p(x) are accurate to within an ulp and log10(x) to within about 2 ulps an ulp is one Unit in the Last Place. The error in pow(x,y) is below about 2 ulps when its magnitude is moderate, but increases as pow(x,y) approaches the over/underflow thresholds until almost as many bits could be lost as are occupied by the floating-point format's exponent field; that is 11 bits for IEEE 754 Double. No such drastic loss has been exposed by testing; the worst errors observed have been below 300 ulps for IEEE 754 Double. Moderate values of pow(3) are accurate enough that pow(integer,integer) is exact until it is bigger than 2**53 for IEEE 754.

RETURN VALUES

These functions will return the appropriate computation unless an error occurs or an argument is out of range. The functions exp(3), expm1(3) and pow(3) detect if the computed value will overflow, set the global variable errno The function pow(x,y) checks to see if x < 0 and y is not an integer, in the event this is true, the global variable errno is set. The variable errno is set to EDOM by log(3) unless x > 0, by log1p(3) unless x > -1.

ERRORS

The exp(3) function can fail for the following reasons:

[EDOM]
The argument x is NaN.
[ERANGE]
The result underflows or overflows.

The log(3) and log10(3) functions can fail for the following reasons:

[EDOM]
The argument x is negative or NaN.
[ERANGE]
The argument x is zero.

The log1p(3) function can fail for the following reasons:

[EDOM]
The argument x is less than -1.0 or is NaN.
[ERANGE]
The argument x is -1.0.

The pow(3) function can fail for the following reasons:

[EDOM]
Either x is negative and y is non-integral; x is zero and y is negative; or y is NaN.
[ERANGE]
The correct value would cause underflow or overflow.

NOTES

The function pow(x,0) returns x**0 = 1 for all x including x = 0, Infinity, and NaN. Previous implementations of pow() may have defined x**0 to be undefined in some or all of these cases.

SEE ALSO

math(3)

infnan(3)