Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 2 - The PowerPC Numerics C Implementation
Chapter 10 - Transcendental Functions /


log10

You can use the log10 function to compute the common logarithm of a real number.

double_t log10 (double_t x);
x
Any positive floating-point number.
DESCRIPTION
The log10 function returns the common (base 10) logarithm of its argument.

log10(x) = log10x = y such that x = 10y

EXCEPTIONS
When x is finite and nonzero, the result of log10(x) 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 the log10 function is a zero, a NaN, or an Infinity, plus other special cases for the log10 function.
Special cases for the log10 function
OperationResultExceptions raised
log10(x) for x < 0NaNInvalid
log10(+1) +0None
log10(+0) - Divide-by-zero
log10(-0) - Divide-by-zero
log10(NaN) NaNNone[36]
log10(+ ) + None
log10(- ) NaNInvalid

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.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996