C log10 function calculates base 10 logarithm for argument

Syntax

C log10 function has the following syntax.

  • float log10f(float num);
  • double log10(double num);
  • long double log10l(long double num);

C log10 functions are from math.h.

Description

C log10 functions return the base 10 logarithm for num.

Example

The following code calculates base 10 logarithm for argument by using C log10 function.


#include <math.h>
#include <stdio.h>
/*from   w  ww  .  jav a 2  s .com*/
int main(void)
{
  double val = 1.0;

  do {
    printf("%f %f\n", val, log10(val));
    val++;
  } while (val<11.0);

  return 0;
}

The code above generates the following result.





















Home »
  C Language »
    Function Reference »




assert.h
ctype.h
math.h
setjmp.h
signal.h
stdio.h
stdlib.h
string.h
time.h
wctype.h