generic
    type Argument is digits <>;
    type Return_Value is digits <>;
package Natural_Package is
    --==================================================================
    -- This package provides the natural log function that returns the
    -- log base e of a positive, floating-point number.
    --
    -- This package attempts to do some minimal numerical analysis in
    -- order to compute the result to the requested accuracy.  The
    -- expression for the termination of the loop comes from the book
    -- "Portability and Style in Ada" by Nissen and Wallis.
    --
    -- The method used to compute the natural log is based on the
    -- Taylor series expansion for ln x:
    --    ln(x) = 2 * {     (x-1)/(x+1)     +
    --                  1/3[(x-1)/(x+1)]**3 +
    --                  1/5[(x-1)/(x+1)]**5 + ...}
    --
    -- The accuracy of the calcuation is improved by first by using the
    -- mathmatical property that ln(e**x) = x*ln(e) = x.  In this case,
    -- the number being passed into the log function is repeatedly
    -- divided by e to find out the highest power of e that is a factor
    -- of the argument.  This power then becomes the characteristic of
    -- the log function.  The remainder of the log function is then
    -- put into the Taylor series and it's value calculated.  This is
    -- then the mantissa of the log of the argument.
    --
    -- The exception Negative_Log is raised if the argument to the
    -- log function is <= 0.0
    --
    -- The exception Value_To_Large is raised if the argument to the
    -- log function causes an overflow to occur. (i.e. if Numeric_Error
    -- or Constraint_Error is raised).
    --
    -- Version 2.0 December 5, 1985
    --
    -- Written by Brad Balfour with help and suggestions from
    -- Ed Berard, Johan Margono and Gary Russell
    --==================================================================


    function Log (Of_Value : in Argument) return Return_Value;
    --
    -- calculates the natural log of a positive floating point number
    -- as described above
    --

    Negative_Log : exception;
    --
    -- raised if the user tries to take the log of a number <= 0
    --

    Value_Too_Large : exception;
    --
    -- raised if the argument to the log function is too big to
    -- be handled on the particular machine.
    --

end Natural_Package;
