log10 - C math.h

C examples for math.h:log10

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Returns the common (base-10) logarithm of x.

Prototype

long double log10l (long double x);
long double log10 (long double x);
     double log10 (double x);
      float log10f (float x);
      float log10 (float x);
     double log10 (T x);           

Parameters

Parameter Description
x Value whose logarithm is calculated. If the argument is negative, a domain error occurs.

Return Value

Common logarithm of x.

If x is negative, it causes a domain error.

If x is zero, it may cause a pole error (depending on the library implementation).

Example

Demo Code


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

int main ()//from   w  w  w.  j a  v a2s  .  c o m
{
  double param = 1234.0;
  
  double result = log10 (param);
  
  printf ("log10(%f) = %f\n", param, result );
  
  return 0;
}

Related Tutorials