lloogg1100() -- Mathematics Function (libm)

Compute common logarithm
#iinncclluuddee <mmaatthh.hh>
ddoouubbllee lloogg1100(_z) ddoouubbllee _z;

lloogg1100() returns the common (base 10) logarithm of its argument _z.

_E_x_a_m_p_l_e
The following example, called ffaacctt.cc,  uses lloogg1100() and ppooww() to compute an
approximation of the factorial of an integer.  Compile it with the command:

    cc -f fact.c -lm

It is by Brent Seidel (brent_seidel@chthone.stat.com).

#include <math.h>
#include <stdio.h>
#include <stdlib.h>

main()
{
    int num, loop, exponent;
    double sum, fraction;
    char buffer[50];

    fprintf(stderr, "Enter number to compute factoral of: ");
    fflush(stderr);
    if (gets(buffer) == NULL)
        exit(EXIT_FAILURE);

    num = atoi(buffer);
    for (sum = 0, loop = 2; loop <= num; loop++) {
        sum += log10((double) loop);
    }

    exponent = (int) sum;
    fraction = sum - exponent;
    printf("The factoral of %d is %g X 10^%d\n",
        num, pow(10.0, fraction), exponent);
}

_S_e_e _A_l_s_o
lloogg(), lliibbmm
ANSI Standard, section 7.5.4.5
POSIX Standard, section 8.1

_D_i_a_g_n_o_s_t_i_c_s
A domain error  in lloogg1100() (_z is less than  or equal to zero) sets eerrrrnnoo to
EEDDOOMM and returns zero.
