|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T V
Length: 2620 (0xa3c)
Types: TextFile
Names: »V«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
generic
type Base is digits <>;
type Exponent is digits <>;
type Return_Type is digits <>;
package Raised is
--==================================================================
-- This package encapsulates an overloading of the exponential
-- operator that will raise a floating point number to a floating
-- point power.
--
-- 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 exponentail is based on the
-- fact that
-- a ** x = e ** (x * ln(a))
-- where ln is the natural log function and e is its base.
-- This is then further refined by saying that x = y.z where
-- y is the integer part of the number and z is the fractional
-- part. Therefore:
-- a ** x = a ** y.z = a ** (y.0 + 0.z) = (a ** y.0) * (a ** 0.z)
-- and then calculating a ** y.0 as a ** y using Ada's exponential
-- function and expanding the other half to be:
-- (a ** y) * [e ** (0.z * ln(a))]
-- Now e ** (0.z * ln(a)) is calculated using the Taylor series
-- expansion:
-- e ** (0.z * ln(a)) = 1 + 0.z*ln(a) + (0.z*ln(a))**2/2! + ...
--
--
-- Will raise the exception Negative_Base if the user tries to raise
-- a number <= 0 to a fractional power.
--
-- Will raise the exception Value_Too_Large if the result is too
-- large to compute on the particular machine
--
--
-- Version 2.0 December 6, 1985
--
-- Written by Brad Balfour with help and suggestions from
-- Ed Berard, Johan Margono and Gary Russell
--==================================================================
function "**" (Some_Base : in Base; To_The_Power : in Exponent)
return Return_Type;
--===============================================================
--
-- calculates a ** x for a and x being floating point numbers.
--
-- Version 2.0 December 6, 1985
--
-- Written by Brad Balfour with help and suggestions from
-- Ed Berard, Johan Margono and Gary Russell
--===============================================================
Negative_Base : exception;
--
-- Raised if the user tries to raise
-- a number <= 0 to a fractional power.
--
Value_Too_Large : exception;
--
-- Raised if the result is too
-- large to compute on the particular machine
--
end Raised;