CVS difference for ais/ai-00203.txt

Differences between 1.1 and version 1.2
Log of other versions for file ais/ai-00203.txt

--- ais/ai-00203.txt	1998/09/30 00:17:36	1.1
+++ ais/ai-00203.txt	1998/10/03 04:28:56	1.2
@@ -1,29 +1,97 @@
-!standard 03.05.08 (02)                               98-03-27  AI95-00203/00
+!standard 03.05.08 (02)                               98-09-08  AI95-00203/01
 !class binding interpretation 98-03-27
+!status work item 98-09-08
 !status received 98-03-27
 !priority Medium
 !difficulty Hard
-!subject T'Model_Mantissa{ if T'Machine_Radix is not 10, and T'Model_Mantissa otherwise}.
+!subject S'Digits when T'Machine_Radix is 10.
 
-!summary 98-03-27
+!summary 98-09-08
 
+The relationship between S'Digits and T'Model_Mantissa given in
+3.5.8(2) states that S'Digits is the largest value of d for which
 
-!question 98-03-27
+   ceiling(d * log(10)/log(T'Machine_Radix)) + 1 <= T'Model_Mantissa
 
+This allows for a "guard digit" which is necessary to take care of
+extreme circumstances which arise if the Machine_Radix is not
+decimal (as is usually the case).
 
-!recommendation 98-03-27
+However, this guard digit is unnecessary if Machine_Radix is 10 or a
+power of 10 and in such a case the relationship should read
 
+   ceiling(d * log(10)/log(T'Machine_Radix)) <= T'Model_Mantissa
 
-!wording 98-03-27
+If Machine_Radix is 10 this becomes simply
 
+   d <= T'Model_Mantissa
 
-!discussion 98-03-27
+so that S'Digits = T'Model_Mantissa.
 
+!question 98-09-08
 
+The relationship given in 3.5.8(2) in the case of T'Machine_Radix =
+10 implies that S'Digits + 1 = T'Model_Mantissa in such a case. Is
+this correct?
+
+!recommendation 98-09-08
+
+(See Summary.)
+
+!wording 98-09-08
+
+!discussion 98-09-08
+
+This question echoes back to a change made between 1980 preliminary
+Ada and the 1983 standard which is worth explaining as background.
+
+In Ada 83, the user specified a number D of decimal digits and the
+implementation then provided model numbers using B binary digits.
+Intuitively one might expect to need log 10/log 2 (3.3219...) binary
+digits for every decimal digit (with appropriate rounding up). The
+1980 edition of the ARM (3.5.7 third paragraph) says
+
+   (B is the next integer above D*ln(10)/ln(2)).
+
+So 1 decimal digit might be expected to be equivalent to 4 binary
+digits, 2 decimal digits equivalent to 7 binary digits and so on.
+But this is not enough. Four binary digits give a relative precision
+of between 1 in 8 and 1 in 16 whereas one decimal digit requests a
+maximum precision of 1 in 10. Thus there are places where the model
+numbers for B = 4 are slightly too far apart.
+
+For example the decimal model numbers around 10000 for D = 1 are
+
+   8000  9000  10000  20000
+
+whereas the binary model numbers for B = 4 are
+
+   7680  8192  9216  10240
+
+and 8192 and 9216 are more than 1000 apart.
+
+This surprising behaviour resulted in the addition of one to the
+formula so that 3.5.7(6) of Ada 83 concludes
+
+   (The number B is the integer next above (D*log(10)/log(2)) + 1.)
+
+In Ada 95 this formula has been generalized to use T'Machine_Radix
+rather than 2. However, the special case where Machine_Radix is 10
+(or indeed a power of 10) has been overlooked since then no
+anomalous situations can arise and the "guard digit" is not
+required.
+
+The formula should therefore be adjusted accordingly.
+
+Note the peculiar phenomenon that more digits may be required for a
+hexadecimal machine than a decimal machine. Thus one decimal digit
+requires 2 hexadecimal digits.
+
 !appendix 98-03-27
 
 !section 3.5.8(2)
-!subject T'Model_Mantissa{ if T'Machine_Radix is not 10, and T'Model_Mantissa otherwise}.
+!subject T'Model_Mantissa( if T'Machine_Radix is not 10, and
+T'Model_Mantissa otherwise).
 !reference RM95-3.5.8(2)
 !from Samuel Figueroa 98-03-06
 !keywords floating point digits attribute
@@ -35,3 +103,4 @@
 ought to simplify to "d = T'Model_Mantissa" when T'Machine_Radix is 10.
 
 ****************************************************************
+

Questions? Ask the ACAA Technical Agent