Updated: 2021/Apr/14

LOG(3) Library Functions Manual LOG(3)NAMElog,logf,log10,log10f,log1p,log1pf,log2,log2f- logarithm functionsLIBRARYMath Library (libm, -lm)SYNOPSIS#include<math.h>doublelog(double x); floatlogf(float x); doublelog10(double x); floatlog10f(float x); doublelog1p(double x); floatlog1pf(float x); doublelog2(double x); floatlog2f(float x);DESCRIPTIONThe following functions compute logarithms:⊕Thelog() andlogf() functions return the natural logarithm.⊕Thelog10() andlog10f() functions return the base 10 logarithm.⊕Thelog1p() andlog1pf() functions return the natural logarithm of (1.0 + x) accurately even for very small values of x.⊕Thelog2() andlog2f() functions return the base 2 logarithm.RETURNVALUESUpon successful completion, the functions return the logarithm of x as described above. Otherwise 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, thelog(),log10(), andlog2() families return either -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, whereas thelog1p() family returns x. 4. If x is +1.0, thelog(),log10(), andlog2() families return +0.0. If x is -1.0, thelog1p() 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 bylog() unless x > 0, bylog1p() unless x > -1.SEEALSOexp(3), ilogb(3), math(3)STANDARDSThe described functions conform to ISO/IEC 9899:1999 ("ISO C99").HISTORYAlog() function appeared in Version 1 AT&T UNIX. NetBSD 9.99 September 2, 2019 NetBSD 9.99