C log10()

C log10() Prototype

double log10( double arg );

It takes a single argument and returns a value of type float.

[Mathematics] log10x = log10(x) [In C programming]

It is defined in <math.h> header file.

In order to find the log10() of long double or float, use the following prototype.

long double log10l( long double arg);
float log10f( float arg);

C log10() range

Argument remarks
arg > 0 Finds the log10 of the argument
arg < 0 Shows run-time error.

Example: C log10() function

#include <stdio.h>
#include <math.h>
int main()
{
    double num = 4.00, result;

    result = log10(num);
    printf("log10(%.1f) = %.2f", num, result);

    return 0;
}
log(4.0) = 0.60
Did you find this article helpful?