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 - download
Index: ┃ B T

⟦b9a400e68⟧ TextFile

    Length: 3399 (0xd47)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦9b477e385⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦9b477e385⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦9b477e385⟧ 
            └─⟦this⟧ 

TextFile

with Floating_Characteristics;
use Floating_Characteristics;

package body Numeric_Primitives is

    function Sign (X, Y : Float) return Float is
        --  Returns the value of X with the sign of Y
    begin
        if Y >= 0.0 then
            return X;
        else
            return -X;
        end if;
    end Sign;

    function Max (X, Y : Float) return Float is
    begin
        if X >= Y then
            return X;
        else
            return Y;
        end if;
    end Max;

    function Min (X, Y : Float) return Float is
    begin
        if X <= Y then
            return X;
        else
            return Y;
        end if;
    end Min;

    function Truncate (X : Float) return Float is
        --  Optimum code depends on how the system rounds at exact halves
    begin
        if Float (Integer (X)) = X then
            return X;
        end if;

        if X > Zero then
            return Float (Integer (X - Half));
        elsif X = Zero then
            return Zero;
        else
            return Float (Integer (X + Half));
        end if;
    end Truncate;

    function Round (X : Float) return Float is
    begin
        return Float (Integer (X));
    end Round;

    package Key is
        X : Integer := 10_001;
        Y : Integer := 20_001;
        Z : Integer := 30_001;
    end Key;

    function Ran return Float is
        --  This rectangular random number routine is adapted from a report
        --  "A Pseudo-Random Number Generator" by B. A. Wichmann and I. D. Hill
        --  NPL Report DNACS XX (to be published)
        --  In this stripped version, it is suitable for machines supporting
        --  INTEGER at only 16 bits and is portable in Ada
        W : Float;
    begin
        Key.X := 171 * (Key.X mod 177 - 177) - 2 * (Key.X / 177);

        if Key.X < 0 then
            Key.X := Key.X + 30269;
        end if;

        Key.Y := 172 * (Key.Y mod 176 - 176) - 35 * (Key.Y / 176);

        if Key.Y < 0 then
            Key.Y := Key.Y + 30307;
        end if;

        Key.Z := 170 * (Key.Z mod 178 - 178) - 63 * (Key.Z / 178);

        if Key.Z < 0 then
            Key.Z := Key.Z + 30323;
        end if;

        --  CONVERT_TO_FLOAT is used instead of FLOAT since the floating
        --  type may be software defined
        W := Convert_To_Float (Key.X) / 30269.0 +
                Convert_To_Float (Key.Y) / 30307.0 +
                Convert_To_Float (Key.Z) / 30323.0;
        return W - Convert_To_Float (Integer (W - 0.5));
    end Ran;
begin
    Pi := Convert_To_Float (Integer (3)) +
             Convert_To_Float (Mantissa_Type (0.14159_26535_89793_23846));
    One_Over_Pi := Convert_To_Float (Mantissa_Type (0.31830_98861_83790_67154));
    Two_Over_Pi := Convert_To_Float (Mantissa_Type (0.63661_97723_67581_34308));
    Pi_Over_Two := Convert_To_Float (Integer (1)) +
                      Convert_To_Float
                         (Mantissa_Type (


                                         0.57079_63267_94896_61923));
    Pi_Over_Three := Convert_To_Float (Integer (1)) +
                        Convert_To_Float (Mantissa_Type
                                             (0.04719_75511_96597_74615));
    Pi_Over_Four := Convert_To_Float
                       (Mantissa_Type (0.78539_81633_97448_30962));
    Pi_Over_Six := Convert_To_Float (Mantissa_Type (0.52359_87755_98298_87308));
end Numeric_Primitives;