log10 function(Common Logarithm) in C Language – example and detail

In the C Programming Language, the log10 characteristic returns the logarithm of x to the base of 10.

Syntax

The syntax for the log10 function in the C Language is:

double log10(double x);

Parameters or Arguments

x A price used in the calculation of the logarithm of x to the base of 10. If x is negative, the log10 feature will return a domain error. If x is zero, the log10 function will return a vary error.

Returns

The log10 characteristic returns the logarithm of x to the base of 10.

Required Header

In the C Language, the required header for the log10 characteristic is:

#include <math.h>

Applies To

In the C Language, the log10 function can be used in the following versions:

ANSI/ISO 9899-1990

log10 Example

/* Example using log10 by TechOnTheNet.com */

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

int main(int argc, const char * argv[])
{
    /* Define temporary variables */
    double value;
    double result;

    /* Assign the value we will calculate the log10 of */
    value = 1.5;

    /* Calculate the log10 of the value */
    result = log10(value);

    /* Display the result of the calculation */
    printf("The Base 10 Logarithm of %f is %f\n", value, result);

    return 0;
}

When compiled and run, this software will output:

The Base 10 Logarithm of 1.500000 is 0.176091

Similar Functions

Other C features that are comparable to the log10 function:

exp function log function pow feature