log10 -- Compute the Common Logarithm

SYNOPSIS

 #include <math.h>

 double log10(double x);
 

DESCRIPTION

log10 computes the common (base 10) log of its argument x. The x argument must be a positive double-precision, floating-point number.

RETURN VALUE

log10 returns the common log of its argument, expressed as a double-precision, floating-point number.

DIAGNOSTICS

If x is negative or 0, log10 returns -HUGE_VAL. In this case, the run-time library also writes an error message to the standard error file (stderr).

If an error occurs in log10, the _matherr routine is called. You supply your own version of _matherr to suppress the diagnostic message or modify the value returned.

EXAMPLE

This example calculates the common log of RATE, and rounds up using log10:
  #include <math.h>
  #include <stdio.h>

  #define RATE .017

  main()
  {
     double y;
     y = ceil(log10(RATE));

        /* Print the "order of magnitude" of RATE. */
     printf("ceil(log10(%f)) = %fn", RATE, y);
  }

 

RELATED FUNCTIONS

log, _matherr

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.