Computes the natural logarithm.
#include <math.h> float logf (x) float x; long double logl (x) long double x; double log (x) double x;
The logf, logl, and log subroutines compute the natural logarithm of the x parameter, loge (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.
x | Specifies the value to be computed. |
Upon successful completion, the logf, logl, and log subroutines return the natural logarithm of x.
If x is ±0, a pole error occurs and the logf, logl, and log subroutines return -HUGE_VALF and -HUGE_VALL, and -HUGE_VAL, respectively.
For finite values of x that are less than 0, or if x is -Inf, a domain error occurs, and a NaN is returned.
If x is NaN, a NaN is returned.
If x is 1, +0 is returned.
If x is +Inf, x is returned.
When using the libm.a library:
log | If the x parameter is less than 0, the log subroutine returns a NaNQ value and sets errno to EDOM. If x= 0, the log subroutine returns a -HUGE_VAL value but does not modify errno. |
When using libmsaa.a(-lmsaa):
log | If the x parameter is not positive, the log subroutine returns a -HUGE_VAL value, and sets errno to a EDOM value. A message indicating DOMAIN error (or SING error when x = 0) is output to standard error. |
log | If x<0, the logl subroutine returns a NaNQ value |
exp, expf, or expl Subroutine, feclearexcept Subroutine, fetestexcept Subroutine, class, _class, finite, isnan, or unordered Subroutines, and log10, log10f, or log10l Subroutine.
math.h in AIX 5L Version 5.2 Files Reference.