aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-09-18 00:32:34 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-26 04:59:09 -0400
commit4d4a3fb738ea6a06bad492168141e8bfd1788d43 (patch)
tree0b90f521e82e4fba1554e1e7573bff4410316efc /gcc/ada
parent86d774f68ee399ec3f17549aed9f2d0baeb0ea81 (diff)
downloadgcc-4d4a3fb738ea6a06bad492168141e8bfd1788d43.zip
gcc-4d4a3fb738ea6a06bad492168141e8bfd1788d43.tar.gz
gcc-4d4a3fb738ea6a06bad492168141e8bfd1788d43.tar.bz2
[Ada] Relax assertion on Small in Ada.Text_IO.Fixed_IO
gcc/ada/ * libgnat/a-tifiio.adb: Change the range of supported Small values. (E0, E1, E2): Adjust factors. (Exact): Return false if the Small does not fit in 64 bits.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/libgnat/a-tifiio.adb22
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/ada/libgnat/a-tifiio.adb b/gcc/ada/libgnat/a-tifiio.adb
index 35951dc..f48239f 100644
--- a/gcc/ada/libgnat/a-tifiio.adb
+++ b/gcc/ada/libgnat/a-tifiio.adb
@@ -261,10 +261,8 @@ package body Ada.Text_IO.Fixed_IO is
-- will not overflow.
pragma Assert (System.Fine_Delta >= 2.0**(-63));
- pragma Assert (Num'Small in 2.0**(-63) .. 2.0**63);
+ pragma Assert (Num'Small in 2.0**(-80) .. 2.0**80);
pragma Assert (Num'Fore <= 37);
- -- These assertions need to be relaxed to allow for a Small of
- -- 2.0**(-64) at least, since there is an ACATS test for this ???
Max_Digits : constant := 18;
-- Maximum number of decimal digits that can be represented in a
@@ -275,9 +273,9 @@ package body Ada.Text_IO.Fixed_IO is
-- decimal point.
subtype Int is Integer;
- E0 : constant Int := -(20 * Boolean'Pos (Num'Small >= 1.0E1));
- E1 : constant Int := E0 + 10 * Boolean'Pos (Num'Small * 10.0**E0 < 1.0E-10);
- E2 : constant Int := E1 + 5 * Boolean'Pos (Num'Small * 10.0**E1 < 1.0E-5);
+ E0 : constant Int := -(25 * Boolean'Pos (Num'Small >= 1.0E1));
+ E1 : constant Int := E0 + 13 * Boolean'Pos (Num'Small * 10.0**E0 < 1.0E-13);
+ E2 : constant Int := E1 + 6 * Boolean'Pos (Num'Small * 10.0**E1 < 1.0E-6);
E3 : constant Int := E2 + 3 * Boolean'Pos (Num'Small * 10.0**E2 < 1.0E-3);
E4 : constant Int := E3 + 2 * Boolean'Pos (Num'Small * 10.0**E3 < 1.0E-1);
E5 : constant Int := E4 + 1 * Boolean'Pos (Num'Small * 10.0**E4 < 1.0E-0);
@@ -288,10 +286,12 @@ package body Ada.Text_IO.Fixed_IO is
and then Num'Small * 10.0**Scale < 10.0);
Exact : constant Boolean :=
- Float'Floor (Num'Small) = Float'Ceiling (Num'Small)
- or else Float'Floor (1.0 / Num'Small) = Float'Ceiling (1.0 / Num'Small)
- or else Num'Small >= 10.0**Max_Digits;
- -- True iff a numerator and denominator can be calculated such that
+ (Float'Floor (Num'Small) = Float'Ceiling (Num'Small)
+ or else Float'Floor (1.0 / Num'Small) = Float'Ceiling (1.0 / Num'Small)
+ or else Num'Small >= 10.0**Max_Digits)
+ and then Num'Small >= 2.0**(-63)
+ and then Num'Small <= 2.0**63;
+ -- True iff a 64-bit numerator and denominator can be calculated such that
-- their ratio exactly represents the small of Num.
procedure Put
@@ -563,7 +563,7 @@ package body Ada.Text_IO.Fixed_IO is
Q : array (0 .. N - 1) of Int64 := (others => 0);
-- Each element of Q has Max_Digits decimal digits, except the
- -- last, which has eAA rem Max_Digits. Only Q (Q'First) may have an
+ -- last, which has AA rem Max_Digits. Only Q (Q'First) may have an
-- absolute value equal to or larger than 10**Max_Digits. Only the
-- absolute value of the elements is not significant, not the sign.