|
|
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 - metrics - download
Length: 5120 (0x1400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, function Kf_Em1, seg_0130d0, separate Generic_Elementary_Functions
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦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;
nblk1=4
nid=0
hdr6=8
[0x00] rec0=25 rec1=00 rec2=01 rec3=06a
[0x01] rec0=02 rec1=00 rec2=04 rec3=010
[0x02] rec0=26 rec1=00 rec2=02 rec3=034
[0x03] rec0=0b rec1=00 rec2=03 rec3=000
tail 0x2150db58282b15195b9db 0x42a00066462061e03