Chapter Contents

Previous

Next
log10

log10



Compute the Common Logarithm

Portability: ISO/ANSI C conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
DIAGNOSTICS
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


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)) = %f\n", RATE, y);
}


RELATED FUNCTIONS

log , _matherr


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.