aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-11-26 11:25:54 +0100
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-12-13 09:35:59 +0100
commit3ea199a18919585285745c1c71cf9cb53a17d689 (patch)
tree08dbfeeabb4d956d521dcccfa10c1578e4f60297 /gcc
parentd136fa00f0d5faff8397edcd7e4ebb3445ab21b0 (diff)
downloadgcc-3ea199a18919585285745c1c71cf9cb53a17d689.zip
gcc-3ea199a18919585285745c1c71cf9cb53a17d689.tar.gz
gcc-3ea199a18919585285745c1c71cf9cb53a17d689.tar.bz2
ada: Adjust cut-off for scaling of floating-point numbers
The value needs to take into account denormals and encompass Maxdigs. gcc/ada/ChangeLog: * libgnat/s-imager.adb (Maxscaling): Change to Natural constant and add Maxdigs to value.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/s-imager.adb15
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/ada/libgnat/s-imager.adb b/gcc/ada/libgnat/s-imager.adb
index d19fda3..89f9c1b 100644
--- a/gcc/ada/libgnat/s-imager.adb
+++ b/gcc/ada/libgnat/s-imager.adb
@@ -49,14 +49,13 @@ package body System.Image_R is
Maxdigs : constant Natural := 2 * Natural'Min (Uns'Width - 2, Num'Digits);
- Maxscaling : constant := 5000;
- -- Max decimal scaling required during conversion of floating-point
- -- numbers to decimal. This is used to defend against infinite
- -- looping in the conversion, as can be caused by erroneous executions.
- -- The largest exponent used on any current system is 2**16383, which
- -- is approximately 10**4932, and the highest number of decimal digits
- -- is about 35 for 128-bit floating-point formats, so 5000 leaves
- -- enough room for scaling such values
+ Maxscaling : constant Natural := 5000 + Maxdigs;
+ -- Maximum decimal scaling required during conversion of floating-point
+ -- numbers to decimal. This is used to defend against infinite looping
+ -- during the conversion, that could be caused by erroneous execution.
+ -- The largest decimal exponent in absolute value used on any current
+ -- system is 4966 (denormals of IEEE binary128) and we scale up to the
+ -- Maxdigs exponent during the conversion.
package Double_Real is new System.Double_Real (Num);
use type Double_Real.Double_T;