C log function calculates the natural logarithm for argument
Syntax
C log function has the following syntax.
float logf(float num);
double log(double num);
long double logl(long double num);
Header
C log functions are from header file math.h
.
Description
C log functions return the natural logarithm for num
.
Example
The following code shows how to calculate the natural logarithm for argument by using C log function.
#include <math.h>
#include <stdio.h>
//from www. ja va 2 s .c o m
int main(void)
{
double val = 1.0;
do {
printf("%f %f\n", val, log(val));
val++;
} while (val<11.0);
return 0;
}
The code above generates the following result.