Important: The information in this document is obsolete and should not be used for new development.
log10
You can use thelog10
function to compute the common logarithm of a real number.
double_t log10 (double_t x);
x
- Any positive floating-point number.
DESCRIPTION
Thelog10
function returns the common (base 10) logarithm of its argument.such that
EXCEPTIONS
When x is finite and nonzero, the result of might raise one of the following exceptions:
- inexact (for all finite, nonzero values of x other than +1)
- invalid (when x is negative)
SPECIAL CASES
Table 10-15 shows the results when the argument to thelog10
function is a zero, a NaN, or an Infinity, plus other special cases for thelog10
function.
Special cases for the log10
functionOperation Result Exceptions raised for x < 0 NaN Invalid +0 None - Divide-by-zero - Divide-by-zero NaN None[36] + None NaN Invalid EXAMPLES
z = log10(+1.0); /* z = 0.0 because 100 = 1 */ z = log10(10.0); /* z = 1.0 because 101 = 10. The inexact exception is raised. */ z = log10(-1.0); /* z = NAN because negative arguments are not allowed. The invalid exception is raised. */
[36] If the NaN is a signaling NaN, the invalid exception is raised.