From: Eric Botcazou Date: Tue, 26 Nov 2024 10:25:54 +0000 (+0100) Subject: ada: Adjust cut-off for scaling of floating-point numbers X-Git-Tag: basepoints/gcc-16~3365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ea199a18919585285745c1c71cf9cb53a17d689;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/ada/libgnat/s-imager.adb b/gcc/ada/libgnat/s-imager.adb index d19fda3b613d..89f9c1b020a3 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;