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

⟦30da75ef0⟧ TextFile

    Length: 4025 (0xfb9)
    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

------------------------------------------------------------------------
--
--
--
--  U N I V E R S A L    A R I T H M E T I C    P A C K A G E S
--
--     Version: @(#)univ_ar.ada 1.1 Date: 5/30/84
--
--     written by
--
--    Gerry Fisher
--   Computer Sciences Corporation
--        4045 Hancock Street
--        San Diego, CA 92110
--
--
--
-- The packages UNIVERSAL_INTEGER_ARITHMETIC and UNIVERSAL_REAL_ARITHMETIC,
-- implement the arithmetic operations for the Ada* universal_integer and
-- universal_real types.  Unlimited precision arithmetic is used for the
-- universal_integer type and rational arithmetic for the universal_real
-- type.  The implementation is based on the universal arithmetic package
-- written in SETL by Robert Dewar for the NYU Ada/Ed compiler, and was
-- coded in part while the author worked at TeleSoft.
--
-- The implementation presented here is not the most efficient.  It is,
-- however, quite general and requires no low level facilities.  With some
-- tuning these packages could be used within an Ada compiler to evaluate
-- static expressions.  They also provide an excellent example of the use
-- of Ada packages to support an abstract data type.
--



-- * Ada is a registered trademark of the DoD (Ada Joint Program Office)
--
------------------------------------------------------------------------
package Universal_Integer_Arithmetic is

    --  This package implements the Ada type Universal_integer.

    --  The operations defined on universal integers are those specified in
    --  chapter 4 of the RM.  Since the equality and inequality operators can
    --  not be overloaded, an equality operation is defined. In addition,
    --  conversions between INTEGER, STRING and Universal_integer are defined.

    type Universal_Integer is private;

    function "+" (X, Y : Universal_Integer) return Universal_Integer;
    function "-" (X, Y : Universal_Integer) return Universal_Integer;
    function "*" (X, Y : Universal_Integer) return Universal_Integer;
    function "/" (X, Y : Universal_Integer) return Universal_Integer;
    function "mod" (X, Y : Universal_Integer) return Universal_Integer;
    function "rem" (X, Y : Universal_Integer) return Universal_Integer;

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

    function "-" (X : Universal_Integer) return Universal_Integer;
    function "abs" (X : Universal_Integer) return Universal_Integer;

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

    function Int (X : Universal_Integer) return Integer;

    -- Converts a universal integer to a integer.  The exception
    -- NUMERIC_ERROR is raised if the universal integer x has a value
    -- outside the integer range.


    function Ui (I : Integer) return Universal_Integer;

    -- Constructs a universal integer from an integer.


    function Image (X : Universal_Integer) return String;

    -- Converts the universal integer x into its string image, that is, a
    -- sequence of characters representing the value in display form.  The
    -- image of a universal integer value is the corresponding decimal
    -- literal; without underlines, leading zeros, exponent or trailing spaces;
    -- but with a single leading minus sign or space.  The lower bound of the
    -- image string is one.


    function Value (S : String) return Universal_Integer;

    -- Converts the string s into a universal integer value.  The string must have
    -- the syntax of an optionally signed decimal integer literal; otherwise, the
    -- exception CONSTRAINT_ERROR is raised.  The exponent of the decimal literal,
    -- if present, must not exceed INTEGER'LAST.


private

    type Vector;

    type Universal_Integer is access Vector;

end Universal_Integer_Arithmetic;