Version 1.1 of ai12s/ai12-0362-2.txt

Unformatted version of ai12s/ai12-0362-2.txt version 1.1
Other versions for file ai12s/ai12-0362-2.txt

!standard 4.1.4(12/1)          20-06-05 AI12-0362-2/01
!class Amendment 20-06-05
!status work item 20-06-05
!status received 20-06-95
!priority Low
!difficulty Easy
!subject Attributes for fixed point types
!summary
Implementations have permission to extend attributes defined only for floating point types (such as Ceiling) to fixed point types. The semantics of any such extension are implementation-defined.
!problem
There is a growing interest in fixed-point with the emergence of machine learning and GPUs. It is nice if an algorithm can be moved between fixed and float without signifiant re-engineering. However, the attributes Floor Ceiling, Rounding, Unbiased_Rounding, Machine_Rounding, and Truncation are missing for fixed point types. This forces unnecessary conversions to floating point types, which can themselves introduce rounding effects.
!proposal
(See Summary.)
!wording
Replace 4.1.4 (12/1)
An implementation may provide implementation-defined attributes; the identifier for an implementation-defined attribute shall differ from those of the language-defined attributes unless supplied for compatibility with a previous edition of this International Standard.
with
An implementation may provide implementation-defined attributes; the identifier for such an implementation-defined attribute shall differ from those of the language-defined attributes.
An implementation may extend the definition of a language-defined attribute by accepting uses of that attribute that would otherwise be illegal in the following cases:
- in order to support compatibility with a previous edition of
of this International Standard; or
- in the case of a language-defined attribute whose
prefix is required by this International Standard to be a floating point subtype, an implementation may accept an attribute_reference whose prefix is a fixed-point subtype; the semantics of such an attribute_reference are implementation-defined.
!discussion
A suggestion was made to define for fixed point types some of the attributes that are currently defined only for floating point types. These included the Ceiling, Floor, Rounding, Unbiased_Rounding, Machine_Rounding, and Truncation attributes.
It was decided that it was too late in the Ada202x standardization process for this specific change, and that furthermore there are some details that remain to be worked out.
In order to allow implementations to provide this functionality as a legal-but-implementation-dependent language extension, permission is granted to implementations to extend the semantics of language-defined attributes in this case.
!ASIS
[Not sure. It seems like some new capabilities might be needed, but I didn't check - Editor.]
!ACATS test
ACATS B- and C-Tests are needed to check that the new capabilities are supported.
!appendix

****************************************************************


Questions? Ask the ACAA Technical Agent