DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T V

⟦c4757de60⟧ TextFile

    Length: 3864 (0xf18)
    Types: TextFile
    Names: »V«

Derivation

└─⟦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⟧ 

TextFile

with System;
with Universal_Integer_Arithmetic;
use Universal_Integer_Arithmetic;
package Universal_Real_Arithmetic is

    -- This package implements the Ada type Universal_Real.

    -- The operations defined on universal numbers are those specified in
    -- chapter 4 of the RM.  Since the equality and inequality operators can
    -- not be overloaded, an equality function is defined.  A universal real
    -- number corresponds to a unique pair of universal integers that represent
    -- it as a rational number.  a function, UR, is defined that constructs a
    -- universal real number from a pair of universal integers.  Also, the inverse
    -- of this function is provided by two functions, NUMERATOR and DENOMINATOR,
    -- that decompose the rational number representation of their universal real
    -- argument into its numerator and denominator, respectively.  In addition,
    -- conversions between Universal_integer and Universal_real are defined.

    type Universal_Real is private;

    function "+" (X, Y : Universal_Real) return Universal_Real;
    function "-" (X, Y : Universal_Real) return Universal_Real;
    function "*" (X, Y : Universal_Real) return Universal_Real;
    function "/" (X, Y : Universal_Real) return Universal_Real;

    function "**" (X : Universal_Real; Y : Integer) return Universal_Real;

    function "*" (X : Universal_Integer; Y : Universal_Real)
                 return Universal_Real;

    function "*" (X : Universal_Real; Y : Universal_Integer)
                 return Universal_Real;

    function "/" (X : Universal_Real; Y : Universal_Integer)
                 return Universal_Real;

    function "-" (X : Universal_Real) return Universal_Real;

    function "abs" (X : Universal_Real) return Universal_Real;


    function ">=" (X, Y : Universal_Real) return Boolean;
    function ">" (X, Y : Universal_Real) return Boolean;
    function "<=" (X, Y : Universal_Real) return Boolean;
    function "<" (X, Y : Universal_Real) return Boolean;
    function Eql (X, Y : Universal_Real) return Boolean;

    function Ui (X : Universal_Real) return Universal_Integer;

    -- Converts a universal real to a universal integer by rounding.

    function Ur (X : Universal_Integer) return Universal_Real;
    function Ur (X : Integer) return Universal_Real;
    function Ur (X : Long_Integer) return Universal_Real;
    function Ur (X : Float) return Universal_Real;

    -- Converts a universal integer to a universal real.

    function Ur (N, D : Universal_Integer) return Universal_Real;
    function Ur (N, D : Integer) return Universal_Real;
    function Ur (N, D : Long_Integer) return Universal_Real;

    -- Constructs a universal real as the ratio of two universal integers.
    -- The value of d must not be zero; if it is, NUMERIC_ERROR is raised.


    function Numerator (X : Universal_Real) return Universal_Integer;

    -- Returns the numerator of x viewed as a rational number.

    function Denominator (X : Universal_Real) return Universal_Integer;

    -- Returns the denominator of x viewed as a rational number.

    function R_Zero return Universal_Real;
    function R_One return Universal_Real;

    -- Conversion to/from pure value representation

    function Image (X : Universal_Real) return System.Byte_String;
    function Value (S : System.Byte_String) return Universal_Real;

private

    -- A universal real is represented as a rational number consisting
    -- of a pair of universal integers.  The numerator is the first
    -- member of the pair and the denominator is the second.  The
    -- denominator must not be zero.  Also, the numerator, denominator
    -- pair is always reduced to lowest terms.

    type Universal_Real is
        record
            Num : Universal_Integer;
            Den : Universal_Integer;
        end record;

end Universal_Real_Arithmetic;