Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

log, logf, logl - natural logarithm function

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

double log(double x);
C11
float logf(float x);
long double logl(long double x); (End)

Description

These functions compute the natural logarithm of the positive floating-point number x to the base e.

Return val.

ln(x)

for a positive x.

 

-HUGE_VAL
-HUGE_VALF
-HUGE_VALL

depending on the function type, if x is less than or equal to 0.
errno is set to indicate the error.

Errors

log(), logf() and logl() will fail if: 

 

EDOM

The value of x is negative.

 

ERANGE

The value of x is 0.

See also

exp()exp2(), log2()log10(), pow(), sqrt(), math.h.