.TH log10() "" "" "Mathematics Function (libm)"
.PC "Compute common logarithm"
.B "#include <math.h>"
\fBdouble log10(\fIz\^\fB) double \fIz\^\fB;\fR
.PP
\fBlog10()\fR returns the common (base 10) logarithm of its argument \fIz\fR.
.SH Example
The following example, called
.BR fact.c ,
uses
.B log10()
and
.B pow()
to compute an approximation of the factorial of an integer.
Compile it with the command:
.DM
	cc -f fact.c -lm
.DE
.PP
It is by Brent Seidel (brent_seidel@chthone.stat.com).
.DM
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
.DE
.DM
main()
{
	int num, loop, exponent;
	double sum, fraction;
	char buffer[50];
.DE
.DM
	fprintf(stderr, "Enter number to compute factoral of: ");
	fflush(stderr);
	if (gets(buffer) == NULL)
		exit(EXIT_FAILURE);
.DE
.DM
	num = atoi(buffer);
	for (sum = 0, loop = 2; loop <= num; loop++) {
		sum += log10((double) loop);
	}
.DE
.DM
	exponent = (int) sum;
	fraction = sum - exponent;
	printf("The factoral of %d is %g X 10^%d\en",
		num, pow(10.0, fraction), exponent);
}
.DE
.SH "See Also"
.Xr "log()," log
.Xr "libm" libm
.br
\*(AS, \(sc7.5.4.5
.br
\*(PX Standard, \(sc8.1
.SH Diagnostics
A domain error in \fBlog10()\fR (\fIz\fP is less than or equal to zero)
sets \fBerrno\fR to \fBEDOM\fR and returns zero.
