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

⟦6d6c395cd⟧ TextFile

    Length: 5899 (0x170b)
    Types: TextFile
    Names: »B«

Derivation

└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS 
    └─ ⟦91c658230⟧ »DATA« 
        └─⟦458657fb6⟧ 
            └─⟦1472c4407⟧ 
                └─⟦3d4b48c74⟧ 
└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦2e03b931c⟧ 
                └─⟦3d4b48c74⟧ 
                    └─⟦this⟧ 
└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS 
    └─ ⟦91c658230⟧ »DATA« 
        └─⟦458657fb6⟧ 
            └─⟦1472c4407⟧ 
                └─⟦6fef9baf9⟧ 
└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦2e03b931c⟧ 
                └─⟦6fef9baf9⟧ 
                    └─⟦this⟧ 

TextFile

with Float_Operations;
package body Elementary_Functions is

   package Mc68881 renames Float_Operations.Single;

   Pi : constant :=  
      3.1415926535897932384626433832795028841971693993750990042;

   Pi_Over_2       : constant := Pi / 2.0;
   Two_Pi          : constant := Pi * 2.0;
   One_Over_Two_Pi : constant := 1.0 / Two_Pi;
   --

   --------------------------------
   function Sqrt (X : Float) return Float is
   begin
      if X < 0.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Sqrt (X);
   end Sqrt;


   function Log (X : Float) return Float is
   begin
      if X < 0.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Log_E (X);
   end Log;


   function Log (X, Base : Float) return Float is
   begin
      if X < 0.0 or Base <= 0.0 or Base = 1.0 then
         raise Argument_Error;
      end if;
      if Base = 10.0 then
         return Mc68881.Log_10 (X);
      elsif Base = 2.0 then
         return Mc68881.Log_2 (X);
      else
         return Mc68881.Log_E (X) / Mc68881.Log_E (Base);
      end if;
   end Log;


   function Exp (X : Float) return Float is
   begin  
      return Mc68881.E_To_X (X);
   end Exp;


   function "**" (X, Y : Float) return Float is
   begin
      if X = 10.0 then
         return Mc68881.Ten_To_X (Y);
      elsif X = 2.0 then
         return Mc68881.Two_To_X (Y);
      else
         return Mc68881.E_To_X (Y * Mc68881.Log_E (X));
      end if;
   end "**";


   function Sin (X : Float) return Float is
   begin
      return Mc68881.Sin (X);
   end Sin;


   function Sin (X, Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Sin ((Two_Pi * X) / Cycle);
   end Sin;


   function Cos (X : Float) return Float is
   begin
      return Mc68881.Cos (X);
   end Cos;


   function Cos (X, Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Cos ((Two_Pi * X) / Cycle);
   end Cos;


   function Tan (X : Float) return Float is
   begin
      return Mc68881.Tan (X);
   end Tan;


   function Tan (X, Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Tan ((Two_Pi * X) / Cycle);
   end Tan;


   function Cot (X : Float) return Float is
   begin
      return 1.0 / Mc68881.Tan (X);
   end Cot;


   function Cot (X, Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 then
         raise Argument_Error;
      end if;
      return 1.0 / Mc68881.Tan ((Two_Pi * X) / Cycle);
   end Cot;


   function Arcsin (X : Float) return Float is
   begin
      if abs X > 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Asin (X);
   end Arcsin;


   function Arcsin (X, Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 or else abs X > 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Asin (X) * Cycle * One_Over_Two_Pi;
   end Arcsin;


   function Arccos (X : Float) return Float is
   begin
      if abs X > 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Acos (X);
   end Arccos;


   function Arccos (X, Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 or else abs X > 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Acos (X) * Cycle * One_Over_Two_Pi;
   end Arccos;


   function Arctan (Y : Float;  
                    X : Float := 1.0) return Float is
   begin
      if X = 0.0 then
         if Y = 0.0 then
            raise Argument_Error;
         elsif Y > 0.0 then
            return Pi_Over_2;
         else
            return -Pi_Over_2;
         end if;
      end if;

      if Y = 0.0 then
         if X > 0.0 then
            return 0.0;
         else
            return Pi;
         end if;
      end if;

      if X = 1.0 then
         return Mc68881.Atan (Y);
      else
         return Mc68881.Atan (Y / X);
      end if;

   end Arctan;


   function Arctan (Y     : Float;  
                    X     : Float := 1.0;  
                    Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 then
         raise Argument_Error;
      end if;
      return Arctan (Y, X) * Cycle * One_Over_Two_Pi;
   end Arctan;


   function Arccot (X : Float;  
                    Y : Float := 1.0) return Float is
   begin
      return Arctan (X => X, Y => Y);
   end Arccot;


   function Arccot (X     : Float;  
                    Y     : Float := 1.0;  
                    Cycle : Float) return Float is
   begin
      if Cycle <= 0.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Acos (X) * Cycle * One_Over_Two_Pi;
   end Arccot;


   function Sinh (X : Float) return Float is
   begin
      return Mc68881.Sinh (X);
   end Sinh;


   function Cosh (X : Float) return Float is
   begin
      return Mc68881.Cosh (X);
   end Cosh;


   function Tanh (X : Float) return Float is
   begin
      return Mc68881.Tanh (X);
   end Tanh;


   function Coth (X : Float) return Float is
   begin
      return 1.0 / Mc68881.Tanh (X);
   end Coth;


   function Arcsinh (X : Float) return Float is
   begin  
      return Mc68881.Log_E (X + Mc68881.Sqrt (X * X + 1.0));
   end Arcsinh;


   function Arccosh (X : Float) return Float is
   begin
      if X < 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Log_E (X + Mc68881.Sqrt (X * X - 1.0));
   end Arccosh;


   function Arctanh (X : Float) return Float is
   begin
      if abs X > 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Atanh (X);
   end Arctanh;


   function Arccoth (X : Float) return Float is
   begin
      if abs X < 1.0 then
         raise Argument_Error;
      end if;
      return Mc68881.Atanh (1.0 / X);
   end Arccoth;

end Elementary_Functions;