|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 7168 (0x1c00) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, function Arctan, seg_0130c1, separate Generic_Elementary_Functions
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
separate (Generic_Elementary_Functions) function Arctan (Y : Float_Type; X : Float_Type := 1.0) return Float_Type is U, V, Sign_X, Sign_Y, Buffer, Z1, Z2, Result : Common_Float; Swap_Flag : Boolean; Zero : constant := 0.0; One : constant := 1.0; Pi : constant := 3.14159_26535_89793_23846_26433_83279_50288_4197; Pi_By_2 : constant := 1.57079_63267_94896_61923_13216_91639_75144_2098; Pi_By_4 : constant := 0.78539_81633_97448_30961_56608_45819_87572_1049; Pi_3_4 : constant := 2.35619_44901_92344_92884_69825_37459_62716_3147; Pi_Lead : constant Common_Float := 16#3.243#; Piby2_Lead : constant Common_Float := 16#1.921#; Pi_Trail : constant Common_Float := 16#0.F6A88_85A30_8D313_198A2_E0370_7344A_40938#E-3; Piby2_Trail : constant Common_Float := 16#0.FB544_42D18_46989_8CC51_701B8_39A25_2049C#E-3; begin -- Filter out exceptional cases. U := Common_Float (X); Sign_X := Copy_Sign (One, U); U := abs (U); V := Common_Float (Y); Sign_Y := Copy_Sign (One, V); V := abs (V); if V = Zero then if U = Zero then raise Argument_Error; else if Sign_X = One then return (Float_Type (Copy_Sign (Zero, Sign_Y))); else return (Float_Type (Sign_Y * Pi)); end if; end if; end if; if U = Zero then return (Float_Type (Sign_Y * Pi_By_2)); end if; if U = V then if Sign_X = One then return (Float_Type (Sign_Y * Pi_By_4)); else return (Float_Type (Sign_Y * Pi_3_4)); end if; end if; -- Step 1. Argument Reduction. if U < V then Swap_Flag := True; Buffer := U; U := V; V := Buffer; else Swap_Flag := False; end if; -- Step 2. Approximation. Obtain atan(V/U). This is performed by KP_Atn -- which returns atan(V/U) as Z1 + Z2. Moreover, whenever Z1 is non-zero, -- it has at most 4 hex digits and satisfies |Z1| >= 1/16. Kp_Atn (V, U, Z1, Z2); -- Step 3. Reconstruction. Obtain atan(Y,X) via Sign_X, Sign_Y, Swap_Flag, -- and atan(V/U). The reconstruction is based on three relations: -- atan(Y,X) = sign(Y) * atan(|Y|,X), -- atan(|Y|,X) = pi - atan(|Y|,-X), -- atan(|Y|,|X|) = pi/2 - atan(|X|,|Y|). if Swap_Flag = False then if Sign_X = One then -- atan(|Y|,X) = atan(V,U) Result := Z1 + Z2; else -- atan(|Y|,X) = atan(V,-U) = pi - atan(V,U) Result := (Pi_Lead - Z1) + (Pi_Trail - Z2); end if; else if Sign_X = One then -- atan(|Y|,X) = atan(U,V) = pi/2 - atan(V,U) Result := (Piby2_Lead - Z1) + (Piby2_Trail - Z2); else -- atan(|Y|,X) = atan(U,-V) = pi - atan(U,V) = pi - (pi/2 - atan(V,U)) Result := (Piby2_Lead + Z1) + (Piby2_Trail + Z2); end if; end if; return (Float_Type (Copy_Sign (Result, Sign_Y))); end Arctan;
nblk1=6 nid=0 hdr6=c [0x00] rec0=1c rec1=00 rec2=01 rec3=020 [0x01] rec0=01 rec1=00 rec2=06 rec3=014 [0x02] rec0=2e rec1=00 rec2=02 rec3=02e [0x03] rec0=00 rec1=00 rec2=05 rec3=03a [0x04] rec0=20 rec1=00 rec2=03 rec3=00a [0x05] rec0=06 rec1=00 rec2=04 rec3=000 tail 0x2170e741e82b15170df77 0x42a00066462061e03