aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-09-20 21:06:12 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-26 04:59:13 -0400
commit4b0fe398dbee8050a0a1cf9af8133884c6827454 (patch)
tree49a2a7c68e728f8799bff9d449ce210665ca063a /gcc/ada
parent19b00ffa9cb1ea393788d483d554c17513407992 (diff)
downloadgcc-4b0fe398dbee8050a0a1cf9af8133884c6827454.zip
gcc-4b0fe398dbee8050a0a1cf9af8133884c6827454.tar.gz
gcc-4b0fe398dbee8050a0a1cf9af8133884c6827454.tar.bz2
[Ada] Further small edition to documentation of Ada.Text_IO.Fixed_IO
gcc/ada/ * libgnat/a-tifiio.adb: Minor editions to documentation.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/libgnat/a-tifiio.adb31
1 files changed, 14 insertions, 17 deletions
diff --git a/gcc/ada/libgnat/a-tifiio.adb b/gcc/ada/libgnat/a-tifiio.adb
index f6777f6..f5f8979 100644
--- a/gcc/ada/libgnat/a-tifiio.adb
+++ b/gcc/ada/libgnat/a-tifiio.adb
@@ -188,15 +188,15 @@ package body Ada.Text_IO.Fixed_IO is
-- factor 10**E can be trivially handled during final output, by adjusting
-- the decimal point or exponent.
- -- Convert a value X * S of type T to a 64-bit integer value Q equal to
- -- 10.0**D * (X * S) rounded to the nearest integer. This conversion is
+ -- The idea is to convert a value X * S of type T to a 64-bit integer value
+ -- Q equal to 10.0**D * (X * S) rounded to the nearest integer, using only
-- a scaled integer divide of the form
-- Q := (X * Y) / Z,
- -- where all variables are 64-bit signed integers using 2's complement,
- -- and both the multiplication and division are done using full
- -- intermediate precision. The final decimal value to be output is
+ -- where the variables X, Y, Z are 64-bit integers, and both multiplication
+ -- and division are done using full intermediate precision. Then the final
+ -- decimal value to be output is
-- Q * 10**(E-D)
@@ -204,13 +204,12 @@ package body Ada.Text_IO.Fixed_IO is
-- according to the format described in RM A.3.10. The details of this
-- operation are omitted here.
- -- A 64-bit value can contain all integers with 18 decimal digits, but
- -- not all with 19 decimal digits. If the total number of requested output
- -- digits (Fore - 1) + Aft is greater than 18, for purposes of the
- -- conversion Aft is adjusted to 18 - (Fore - 1). In that case, or
- -- when Fore > 19, trailing zeros can complete the output after writing
- -- the first 18 significant digits, or the technique described in the
- -- next section can be used.
+ -- A 64-bit value can represent all integers with 18 decimal digits, but
+ -- not all with 19 decimal digits. If the total number of requested ouput
+ -- digits (Fore - 1) + Aft is greater than 18 then, for purposes of the
+ -- conversion, Aft is adjusted to 18 - (Fore - 1). In that case, trailing
+ -- zeros can complete the output after writing the first 18 significant
+ -- digits, or the technique described in the next section can be used.
-- The final expression for D is
@@ -218,8 +217,6 @@ package body Ada.Text_IO.Fixed_IO is
-- For Y and Z the following expressions can be derived:
- -- Q / (10.0**D) = X * S
-
-- Q = X * S * (10.0**D) = (X * Y) / Z
-- S * 10.0**D = Y / Z;
@@ -248,8 +245,8 @@ package body Ada.Text_IO.Fixed_IO is
-- Extra Precision
-- Using a scaled divide which truncates and returns a remainder R,
- -- another E trailing digits can be calculated by computing the value
- -- (R * (10.0**E)) / Z using another scaled divide. This procedure
+ -- another K trailing digits can be calculated by computing the value
+ -- (R * (10.0**K)) / Z using another scaled divide. This procedure
-- can be repeated to compute an arbitrary number of digits in linear
-- time and storage. The last scaled divide should be rounded, with
-- a possible carry propagating to the more significant digits, to
@@ -564,7 +561,7 @@ package body Ada.Text_IO.Fixed_IO is
-- Each element of Q has Max_Digits decimal digits, except the
-- 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.
+ -- absolute value of the elements is significant, not the sign.
XX : Int64 := X;
YY : Int64 := Y;