function
<cmath> <ctgmath>

log10

double log10 (double x);
double log10  (double x);
float log10f (float x);
long double log10l (long double x);
double log10 (double x);
float log10 (float x);
long double log10 (long double x);
double log10 (double x);
float log10 (float x);
long double log10 (long double x);
Compute common logarithm
Returns the common (base-10) logarithm of x.

Header <tgmath.h> provides a type-generic macro version of this function.
This function is overloaded in <complex> and <valarray> (see complex log10 and valarray log10).

This function is also overloaded in <complex> and <valarray> (see complex log10 and valarray log10).

Parameters

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).

If a domain error occurs, the global variable errno is set to EDOM.
If a pole error occurs, the global variable errno is set ERANGE.
If a domain error occurs:
- And math_errhandling has MATH_ERRNO set: the global variable errno is set to EDOM.
- And math_errhandling has MATH_ERREXCEPT set: FE_INVALID is raised.

If a pole error occurs:
- And math_errhandling has MATH_ERRNO set: the global variable errno is set to ERANGE.
- And math_errhandling has MATH_ERREXCEPT set: FE_DIVBYZERO is raised.

Example

 123456789101112 /* log10 example */ #include /* printf */ #include /* log10 */ int main () { double param, result; param = 1000.0; result = log10 (param); printf ("log10(%f) = %f\n", param, result ); return 0; }

Output:
 log10(1000.000000) = 3.000000