RAD Studio |  |

log10, log10l

Header File

math.h

Category

Math Routines

Prototype

double log10(double x);

long double log10l(long double x);

Description

log10 calculates the base ten logarithm of x.

log10l is the long double version; it takes a long double argument and returns a long double result.

Return Value

On success, log10 (or log10l) returns the calculated value log base ten of x.

If the argument x passed to these functions is real and less than 0, the global variable errno is set to

EDOM | Domain error

If x is 0, these functions return the value negative HUGE_VAL (log10) or _LHUGE_VAL (log10l). Error handling for these routines can be modified through the functions _matherr and _matherrl.

Example

Copy Code

    #include <math.h>
    #include <stdio.h>
    int main(void)
    {
       double result;
       double x = 800.6872;
       result = log10(x);
       printf("The common log of %lf is %lf\n", x, result);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
log10 | + | + | + | +
log10l |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!