English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C library function log10Usage and example of ()

C Standard Library <math.h>

double log10(double x) returns the common logarithm of x (base 10) 10 logarithm).

C log10Function prototype of ()

double log10(double arg);

It accepts a parameter and returns a floating-point value.

[Mathematics] log10x = log10(x) in [C language]

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

log10To calculate long double or float, please use the following prototype.

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

C log10Parameter range of () function

ParameterDescription
arg > 0Calculate log10(arg) result
arg < 0Display runtime errors

Example: C log10Usage of () 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

C Standard Library <math.h>