|
|
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: 3072 (0xc00)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, function Arccosh, seg_0130bd, 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 Arccosh (X : Float_Type) return Float_Type is
-- On input, X is a floating-point value in Float_Type;
-- On output, the value of Arccosh(X) (the inverse hyperbolic cos of X)
-- is returned.
-- The definition of Arccosh(Y) is log( Y + sqrt(Y*Y - 1) ), Y >= 1.
-- To obtain good accuracy, we consider several cases:
-- 1) Y = 1, simply return 0.
-- 2) 1 < Y <= sqrt(2)
-- Y + sqrt(Y*Y-1) = Y + sqrt( (Y-1)*(Y+1) )
-- 3) sqrt(2) < Y < 10/epsilon,
-- Y + sqrt(Y*Y-1) = 2( Y - 0.5/[ sqrt(Y*Y-1) + Y ] ).
-- 4) 10/epsilon <= Y, then
-- Y + sqrt(Y*Y-1) = 2Y for practical purposes.
-- Note that (3) and (4) are suited for invoking the kernel procedure
-- KP_Log(Input) which returns M, Z1, and Z2 where
-- log(Input) = M * log(2) + Z1 + Z2.
--
Y1, Y, M, Z1, Z2, Result : Common_Float;
Zero : constant := 0.0;
One : constant := 1.0;
Half : constant := 0.5;
Root2 : constant := 1.41421_35623_73095_04880_16887_24209_69807;
Large_Threshold : constant Common_Float := 10.0 / Common_Float'Base'Epsilon;
Log2_Lead : constant Common_Float := 16#0.B17#;
Log2_Trail : constant Common_Float :=
16#0.000217F7D1CF79ABC9E3B39803F2F6AF40#;
begin
Y := Common_Float (X);
if (Y < One) then
raise Argument_Error;
end if;
if (Y <= Root2) then
if (Y = One) then
return (Float_Type (Zero));
else
Y1 := Y - One;
Y := Y1 + Kf_Sqrt (Y1 * (Y + One));
return (Float_Type (Kf_L1p (Y)));
end if;
else
if (Y < Large_Threshold) then
Y := Y - Half / (Y + Kf_Sqrt ((Y - One) * (Y + One)));
end if;
Kp_Log (Y, M, Z1, Z2);
M := M + One;
end if;
Result := M * Log2_Lead + (Z1 + (Z2 + M * Log2_Trail));
return (Float_Type (Result));
end Arccosh;
nblk1=2
nid=0
hdr6=4
[0x00] rec0=1d rec1=00 rec2=01 rec3=010
[0x01] rec0=29 rec1=00 rec2=02 rec3=000
tail 0x2170e741682b151698b90 0x42a00066462061e03