Real literals with fixed point multiplication 86-07-23 AI-00020/07 1
| !standard 04.05.05 (10) 86-07-23 AI-00020/07
| !class ramification 84-02-06
| !status approved by WG9/AJPO 86-07-22
| !status approved by Director, AJPO 86-07-22
| !status approved by WG9/Ada Board 86-07-22
| !status approved by Ada Board 86-07-22
!status approved by WG9/ADA Board 85-02-26
!status board-approved 84-06-29
!status committee-approved 84-02-06
!status work-item 83-10-10
!references 83-00128, 83-00129, 83-00201, 83-00207, 83-00208, 83-00217,
| 83-00248, 83-00603
!topic Real literals with fixed point multiplication and division
!summary 84-07-13
A real literal is not allowed as an operand of a fixed point multiplication
or division. The possibility of adopting a more liberal rule in a future
version of the language will be studied.
!question 84-07-13
Multiplication and division are allowed for operands of any fixed point type,
but the Standard appears to forbid fixed point multiplications and divisions
involving real literals. Is this an oversight?
!response 84-03-14
The expression
Fixed_Point_Type (V1 * 3.14)
is illegal when V1 has a fixed point type because * is not defined for one
operand of type universal real and the other operand of some fixed point
type; hence, the expression can only be legal if the real literal can be
converted (implicitly) to a unique fixed point type [4.6(15)]. But there is
no unique fixed point type to which 3.14 can be converted. (There is no
unique fixed point type since there are always at least two fixed point types
whose scope includes every compilation unit -- the type DURATION and the
anonymous predefined fixed point type specified in 3.5.9(7)). The same
argument applies to fixed point division.
It would be possible to extend the language so * and / were defined for
combinations of fixed point types and universal real values. However,
performing such arithmetic operations with the accuracy required by the
Standard is not straightforward. A literal such as 3.14 must be treated as
an exact quantity, i.e., as though its 'SMALL were 3.14. (Then 3.14 will be
represented exactly as a model number.) Consequently, to evaluate V1 * 3.14
correctly requires the same support from a compiler as that required when the
compiler has decided to support 'SMALL values that are not powers of 2.
Since an implementation does not have to support the representation clause
for 'SMALL (at least for values that are not powers of two; see 13.1(10)), it
would be inconsistent to require such support in order to process V1 * 3.14.
Real literals with fixed point multiplication 86-07-23 AI-00020/07 2
The possibility of removing this restriction in a future version of the
Standard will be studied, but the current Standard is unambiguous on this
point.