log10(3C)
_________________________________________________________________
log10 $builtin function
Determine the base 10 logarithm of a number.
_________________________________________________________________
Calling Sequence
double m, n, log10();
m = log10(n);
(or)
$builtin double log10();
double m, n;
m = log10(n);
Description
The log10 function returns the base 10 logarithm of the number
you pass to it. The first version above uses a function call;
the second might generate smaller or faster code, but may not run
under other C compilers.
The include file math.h defines this entry and uses the $builtin
version.
Returns
If the log10 routine receives an illegal input (a zero or a
negative number), it returns -HUGE (defined in math.h) and sets
the last error (errno) to the error code ERANGE. Otherwise, it
returns the base 10 log of the number you pass.
You can redefine the function matherr to provide alternate error
handling.
Related Functions
See also the log function.
Example
/* Program test for the log10() function */
#include <math.h>
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
log10(3C)
double atof(), m, n, log10();
int i = 1;
main(argc, argv)
int argc;
char *argv[];
{
while (i < argc) {
n = atof(argv[i]);
printf("Log to base 10 of %f is %f.\n", n, m = log10(n));
i++;
}
}
A call to the program test with the numbers 2, 2.718, 10, and
1024 generates the output
Log to base 10 of 2.000000 is 0.301030.
Log to base 10 of 2.718000 is 0.434249.
Log to base 10 of 10.000000 is 1.000000.
Log to base 10 of 1024.000000 is 3.010300.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)