exp(), expm1(), log(), log10(), log1p(), pow() - exponential, logarithm, power functions
#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)
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.
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.
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.
The exp(3) function can fail for the following reasons:
The log(3) and log10(3) functions can fail for the following reasons:
The log1p(3) function can fail for the following reasons:
The pow(3) function can fail for the following reasons:
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.
math(3)
infnan(3)