CVS difference for ais/ai-00267.txt
--- ais/ai-00267.txt 2001/05/15 04:14:06 1.1
+++ ais/ai-00267.txt 2001/05/26 02:55:11 1.2
@@ -1,4 +1,4 @@
-!standard 4.6 (33) 01-05-14 AI95-00267/01
+!standard 4.6 (33) 01-05-25 AI95-00267/02
!standard A.5.3 (00)
!class amendment 01-05-14
!status work item 01-05-14
@@ -9,7 +9,7 @@
-An attribute is added to provide high-performance conversions from float types
+An attribute is added to enable high-performance conversions from float types
to integer types when the exact rounding does not matter.
@@ -28,46 +28,51 @@
-The attribute Fast_Round is added to A.5.3.
+The attribute Machine_Rounding is added to A.5.3.
- S'Fast_Round denotes a function with the following specification:
- function S'Fast_Round (X : T) return universal_integer
+ S'Machine_Rounding denotes a function with the following specification:
+ function S'Machine_Rounding (X : T) return T
The function yields the integral value nearest to X. If X lies exactly
- halfway between two integers, one of those integers is returns, but
- which of them is returned is unspecified. This function should use
- whatever rounding is most efficient on the target processor.
+ halfway between two integers, one of those integers is returned, but
+ which of them is returned is unspecified. A zero result has the sign
+ of X when S'Signed_Zeros is True. This function should use whatever
+ rounding is most efficient on the target processor.
-We considered making the return type of the attribute Integer rather than
-Universal_Integer. Doing so might provide slightly easier code generation
-for some compilers. However, we rejected this idea for three reasons:
- -- We do not want to encourage the use of the predefined types. Thus, we
- don't want to force people to use type Integer if they do not want to.
- -- For compilers which support multiple predefined sizes of integer types,
- we do not want to require an extra conversion. For a compiler that has
- a Short_Integer type, an extra check would be required if the attribute
- was defined to return type Integer. Given that the purpose of this
- attribute is to improve performance, we do not want to require extra
- checks. For a compiler that has a Long_Integer type, it would not be
- possible to do a fast conversion into the full range of that type.
- -- The other attributes in A.5.3 generally have parameters and results
- of type Universal_Integer.
-The rounding of Fast_Round is purposely left unspecified. It is not intended
-that users depend on the actual rounding used. (If they need a specific mode
-of rounding, one of the other rounding attributes should be used). If we had
-said that the rounding was implementation-defined, we would be requiring
-documentation of the rounding used, which potentially would encourage users
-to depend on a particular rounding.
+We considered making the return type of the attribute Integer or
+Universal_Integer, but these would be inconsistent with the other rounding
+attributes defined in A.5.3.
+The intended use of this attribute is in a type conversion to some integer
+Implementations should detect this case to generate fast code for the
+conversion of X to Some_Integer. In particular, the usual Float to Integer
+type conversion rounding code is not necessary, as the value has already been
+rounded. (This probably applies to all of the rounding and trunctation
+attributes defined in A.5.3).
+The rounding of Machine_Rounding is purposely left unspecified. It is not
+intended that users depend on the actual rounding used. (If they need a
+specific mode of rounding, one of the other rounding attributes should be
+used). If we had said that the rounding was implementation-defined, we would
+be requiring documentation of the rounding used, which potentially would
+encourage users to depend on a particular rounding.
+Create a C-Test to check for the existence of this attribute. (It can't be
+a test case for CXA5015, as this is an amendment, and will probably not be
+required for years.)
Questions? Ask the ACAA Technical Agent