Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,4 @@
type Interval is record
Lower : Float;
Upper : Float;
end record;

View file

@ -0,0 +1,19 @@
function "+" (A, B : Float) return Interval is
Result : constant Float := A + B;
begin
if Result < 0.0 then
if Float'Machine_Rounds then
return (Float'Adjacent (Result, Float'First), Float'Adjacent (Result, 0.0));
else
return (Float'Adjacent (Result, Float'First), Result);
end if;
elsif Result > 0.0 then
if Float'Machine_Rounds then
return (Float'Adjacent (Result, 0.0), Float'Adjacent (Result, Float'Last));
else
return (Result, Float'Adjacent (Result, Float'Last));
end if;
else -- Underflow
return (Float'Adjacent (0.0, Float'First), Float'Adjacent (0.0, Float'Last));
end if;
end "+";

View file

@ -0,0 +1,10 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Interval_Addition is
-- Definitions from above
procedure Put (I : Interval) is
begin
Put (Long_Float'Image (Long_Float (I.Lower)) & "," & Long_Float'Image (Long_Float (I.Upper)));
end Put;
begin
Put (1.14 + 2000.0);
end Test_Interval_Addition;