You are here : Cmath.hlog

log() - math.h

The C library function double log(double x) returns the natural logarithm (base-e logarithm) of x.


Syntax

double log(double x)


Example

#include <stdio.h>
#include <math.h>

int main ()
{
   double x, ret;
   x = 2.7;

   /* finding log(2.7) */
   ret = log(x);
   printf("log(%lf) = %lf", x, ret);
   
   return(0);
}


Output / Return Value

log(2.700000) = 0.993252


Limitations


Alternatives / See Also


Reference