LOG(3) BSD Programmer's Manual LOG(3)

log,logf,log10,log10f,log1p,log1pf log2,log2f, - logarithm func- tions

libm

#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);

The 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 ofx. • Thelog2() andlog2f() functions return the base 2 logarithm.

Upon successful completion, the functions return the logarithm ofxas descibed above. Otherwise the following may occur: 1. IfxisNaN, all functions returnNaN. 2. Ifxis positive infinity, all functions returnx. Ifxis negative infinity, all functions returnNaN. 3. Ifxis +0.0 or -0.0, thelog(),log10(), andlog2() families return either -HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, whereas thelog1p() family returnsx. 4. Ifxis +1.0, thelog(),log10(), andlog2() families return +0.0. Ifxis -1.0, thelog1p() family returns -HUGE_VAL, - HUGE_VALF, or -HUGE_VALL. In addition, on a VAX,errnois set to EDOM and the reserved operand is returned bylog() unlessx> 0, bylog1p() unlessx> -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. MirOS BSD #10-current September 13, 2011 1

Generated on 2015-10-25 00:47:46 by
`$MirOS: src/scripts/roff2htm,v 1.81 2015/10/16 13:19:09 tg Exp $`

These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2015 The MirOS Project, Germany.

This product includes material
provided by *mirabilos*.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.