compute the logarithm (base 10) of a number
#include <math.h> double log10( double x );
The log10() function computes the logarithm (base 10) of x. A domain error occurs if the argument is negative. A range error occurs if the argument is zero.
The logarithm (base 10) of the argument.
When the argument is outside the permissible range, the matherr() function is called. Unless the default matherr() function is replaced, it will set the global variable errno to EDOM, and print a "DOMAIN error" diagnostic message using the stderr stream.
#include <stdio.h> #include <math.h> void main() { printf( "%f\n", log10(.5) ); }
produces the output:
-0.301030
ANSI
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
errno, exp(), log(), log2(), pow(), matherr()