--  The float attributes of RM A.5.3 (SPARK-36, D192): the static ones of IEEE binary32 and
--  binary64, and the functions, written with Core's operations on floats and their bits;
--  'Remainder exactly, X - N * Y with N the quotient rounded to the even integer at a half.
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
   F : constant Float := 1.5;
   L : constant Long_Float := -6.25;
   procedure Show (X : Long_Float) is
   begin
      Put (Long_Float'Image (X) & " ");
   end Show;
begin
   Put_Line (Integer'Image (Float'Machine_Mantissa) & Integer'Image (Long_Float'Machine_Mantissa)
             & Integer'Image (Float'Machine_Emax) & Integer'Image (Float'Machine_Emin)
             & Integer'Image (Float'Machine_Radix) & Boolean'Image (Float'Denorm)
             & Boolean'Image (Float'Signed_Zeros) & Integer'Image (Long_Float'Model_Mantissa));
   Put_Line (Float'Image (Float'Model_Epsilon) & Float'Image (Float'Model_Small) & Float'Image (Float'Safe_Last));
   Put_Line (Float'Image (Float'Copy_Sign (F, -1.0)) & Float'Image (Float'Adjacent (F, 2.0))
             & Float'Image (Float'Adjacent (F, 0.0)) & Float'Image (Float'Machine (F)) & Float'Image (Float'Model (F)));
   Put_Line (Float'Image (Float'Unbiased_Rounding (2.5)) & Float'Image (Float'Unbiased_Rounding (3.5))
             & Float'Image (Float'Unbiased_Rounding (-2.5)) & Float'Image (Float'Machine_Rounding (2.7)));
   Put_Line (Integer'Image (Float'Exponent (F)) & Float'Image (Float'Fraction (F))
             & Integer'Image (Long_Float'Exponent (L)) & Long_Float'Image (Long_Float'Fraction (L))
             & Integer'Image (Float'Exponent (0.0)) & Integer'Image (Long_Float'Exponent (1.0E-310)));
   Show (Long_Float'Scaling (L, 3)); Show (Long_Float'Scaling (L, -1080)); Show (Long_Float'Compose (L, 1));
   Show (Long_Float'Leading_Part (L, 2)); Show (Long_Float'Leading_Part (1.0 / 3.0, 4));
   New_Line;
   Show (Long_Float'Remainder (7.0, 2.0)); Show (Long_Float'Remainder (5.0, 2.0)); Show (Long_Float'Remainder (-7.5, 2.0));
   Show (Long_Float'Remainder (1.0E300, 3.0)); Show (Long_Float'Remainder (1.0, 3.0)); Show (Long_Float'Remainder (2.0, 3.0));
   Show (Long_Float'Remainder (0.3, 0.1));
   Put_Line (Float'Image (Float'Remainder (10.0, 3.0)));
end Main;
