lloogg() -- Mathematics Function (libm)

Compute natural 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g(_z) ddoouubbllee _z;

lloogg() returns the natural (base _e) logarithm of its argument _z.

_E_x_a_m_p_l_e
The following  example is  by Sanjay Lal  (lals@skule.ecf.toronto.edu).  It
returns the amount of a quantity of radioactive material that remains after
the passage  of a period of  time.  Use it when  planning your next nuclear
dump.  It takes three arguments:  the amount of material, in kilograms; the
half life, in  years; and the time passed, in  years.  These can be decimal
fractions.

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

main(argc, argv)
int argc; char *argv[];
{
    double num, thalf, time;

    if (argc != 4) {
        fprintf(stderr,"Usage: %s amount halflife time\n", argv[0]);
        exit (EXIT_FAILURE);
    }

    num = atof (argv[1]);
    thalf = atof (argv[2]);
    time = atof (argv[3]);
    printf("%f\n", num * exp ( -log(2.0) * (time / thalf)));
}

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

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