]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Add more commentary to System.Val_Real.Large_Powfive
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 6 Jan 2025 08:09:49 +0000 (09:09 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 13 Jan 2025 10:52:57 +0000 (11:52 +0100)
gcc/ada/ChangeLog:

* libgnat/s-valrea.adb (Large_Powfive) [2 parameters]: Add a couple
of additional comments.

gcc/ada/libgnat/s-valrea.adb

index ed22366840f719b63a0e77825e28b7ac4f796f07..aff694dd7219ae8a3965a2e223e6ce8fe70cdcfc 100644 (file)
@@ -396,6 +396,9 @@ package body System.Val_Real is
    begin
       pragma Assert (Exp > Maxexp);
 
+      --  This routine supports any type but it is not necessary to invoke it
+      --  for large types because the above one is sufficient for them.
+
       pragma Warnings (Off, "-gnatw.a");
       pragma Assert (not Is_Large_Type);
       pragma Warnings (On, "-gnatw.a");
@@ -407,6 +410,8 @@ package body System.Val_Real is
       --  its final value does not overflow but, if it's too large, then do not
       --  bother doing it since overflow is just fine. The scaling factor is -3
       --  for every power of 5 above the maximum, in other words division by 8.
+      --  Note that Maxpow is an upper bound of the span of exponents for which
+      --  scaling is needed, but it's OK to apply it even if it is not needed.
 
       if Exp - Maxexp <= Maxpow then
          S := 3 * (Exp - Maxexp);