LOG(3) BSD Library Functions Manual LOG(3)
log, logf, log10, log10f, log1p, log1pf log2, log2f, -- logarithm functions
Math Library (libm, -lm)
The following functions compute logarithms:
o The log() and logf() functions return the natural logarithm.
o The log10() and log10f() functions return the base 10 logarithm.
o The log1p() and log1pf() functions return the natural logarithm of (1.0 + x) accu-
rately even for very small values of x.
o The log2() and log2f() functions return the base 2 logarithm.
Upon successful completion, the functions return the logarithm of x as descibed above. Oth-
erwise the following may occur:
1. If x is NaN, all functions return NaN.
2. If x is positive infinity, all functions return x. If x is negative infinity,
all functions return NaN.
3. If x is +0.0 or -0.0, the log(), log10(), and log2() families return either
-HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, whereas the log1p() family returns x.
4. If x is +1.0, the log(), log10(), and log2() families return +0.0. If x is -1.0,
the log1p() family returns -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL.
In addition, on a VAX, errno is set to EDOM and the reserved operand is returned by log()
unless x > 0, by log1p() unless x > -1.
exp(3), ilogb(3), math(3)
The described functions conform to ISO/IEC 9899:1999 (``ISO C99'').
The history of the logarithm functions dates back to Version 6 AT&T UNIX.
BSD September 13, 2011 BSD