|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 1989 (0x7c5) Types: TextFile Names: »B«
└─⟦5f3412b64⟧ Bits:30000745 8mm tape, Rational 1000, ENVIRONMENT 12_6_5 TOOLS └─ ⟦91c658230⟧ »DATA« └─⟦458657fb6⟧ └─⟦1472c4407⟧ └─⟦this⟧ └─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3 └─ ⟦fc9b38f02⟧ »DATA« └─⟦9b46a407a⟧ └─⟦2e03b931c⟧ └─⟦this⟧
separate (Generic_Elementary_Functions) function Kf_Em1 (Y : Common_Float) return Common_Float is -- On input, Y is a floating point value in Common_Float; -- On output, a Common_Float value is returned that represents -- exp(Y) - 1 for general cases. X, X2, Z1, Z2, Z1_Prime : Common_Float; Z2_Prime, Cond, Result : Common_Float; M, L, L_Rem, D : Common_Int; Two_To : constant array (Common_Int range -3 .. 3) of Common_Float := (0.125, 0.25, 0.5, 1.0, 2.0, 4.0, 8.0); Log2 : constant := 16#0.B17217F7D1CF79ABC9E3B39803F2F6AF40#; Log2_By_64 : constant := 16#0.02C5C85FDF473DE6AF278ECE600FCBDAB#; begin X := Y; D := Float_Type'Base'Digits; Cond := -6.0 * Common_Float (D) * Log2; if (X < Cond) then return (-1.0); end if; if (abs (X) < Log2_By_64) then X2 := 0.0; return Kf_Em1sm (X, X2); end if; -- Get M, Z1, and Z2 so that Exp(X) = 2**M * (Z1 + Z2) Kp_Exp (X, M, Z1, Z2); -- Calculate L, Z1_Prime, and Z2_Prime such that -- 2**M * (Z1 + Z2) = Radix**L * (Z1_Prime + Z2_Prime) case Common_Float'Machine_Radix is when 2 => L := M; Z1_Prime := Z1; Z2_Prime := Z2; when others => -- Radix is 16 L_Rem := M rem 4; L := (M - L_Rem) / 4; Z1_Prime := Z1 * Two_To (L_Rem); Z2_Prime := Z2 * Two_To (L_Rem); end case; -- Now Exp(X) - 1 = Radix**L * (Z1_Prime + Z2_Prime) - 1 -- The following is the computation of Exp(X) - 1 if (M = 0) then Result := (Z1_Prime - 1.0) + Z2_Prime; elsif (abs (M) <= D) then Result := Scale (Z2_Prime, L); Result := (Scale (Z1_Prime, L) - 1.0) + Result; elsif (M < -D) then Result := Z1_Prime + Z2_Prime; Result := Scale (Result, L) - 1.0; else Result := Z2_Prime - Scale (1.0, -L); Result := Z1_Prime + Result; Result := Scale (Result, L); end if; return (Result); end Kf_Em1;