<MATH.H>
log and logl = natural logarithm function
log10 and log10l = common logarithm function
Declaration:
Real: double log(double x);
double
log10(double x);
long
double logl(long double (x));
long
double log10l(long double (x));
Complex: complex log(complex
x);
complex
log10(complex x);
Remarks:
Real versions:
log and logl
calculate the natural logarithm of x.
log10 and log10l
calculate the base 10 logarithm of x.
Complex versions:
The complex natural logarithm is defined by
log(z) = log(abs(z))
+ i arg(z)
The complex common logarithm is defined by
log10(z) = log(z) /
log(10)
Return Value:
On
success,
log and logl return the natural log of x
log10 and log10l the return log (base 10) of x
On
error,
if x = 0, these functions set errno to ERANGE
log
and log10 return negative HUGE_VAL
logl
and log10l return negative _LHUGE_VAL
Program
#include <math.h>
#include <stdio.h>
int main(void)
{
double result;
double x = 8.6872;
result = log(x);
printf("The
natural log of %lf is %lf\n", x, result);
return 0;
}
0 comments:
Post a Comment