'SMALL can be specified for a derived fixed point type AI-00099/12 1
88-05-23 ra WJ
| !standard 13.02 (12) 88-05-23 AI-00099/12
!class ramification 85-01-31
| !status approved by WG9/AJPO 88-02-05
| !status approved by Director, AJPO 88-02-05
| !status approved by WG9/Ada Board 87-12-07
| !status approved by Ada Board 87-07-30
!status panel/committee-approved 87-03-16 (reviewed)
!status panel/committee-approved (5-0-1) 86-11-14 (pending editorial review)
!status work-item 86-05-09
!status returned to committee by WG9 86-05-09
!status committee-approved (7-0-0) 86-02-21
!status work-item 85-01-31
!status received 84-01-10
!references AI-00138, AI-00341, 83-00237, 83-00651, 83-00705, 83-00738,
83-00757, 83-00783, 83-00794
!topic 'SMALL can be specified for a derived fixed point type
!summary 87-03-13
A representation clause specifying SMALL for a derived fixed point type is
allowed if the resulting model numbers are (representable) values of the
parent type and the value specified for SMALL is not greater than the delta
of the derived type.
!question 85-01-31
13.2(12) imposes no restriction on the application of 'SMALL to a derived
fixed point type. For example, could 0.1, 0.5, 1.0, 2.0, and 4.0 all be
specified as values of DF1'SMALL in the example below?
type F1 is delta 1.0 range -15.0 .. 15.0; -- F1'SMALL = 1.0
type DF1 is new F1 delta 4.0;
for DF1'SMALL use ...;
| !response 87-12-07
3.4(4) says the set of values of a derived type is a copy of the set of
values for the parent type. 3.5.6(3) says an implementation of a real type
must include the model numbers of the type and represent them exactly. The
effect of specifying SMALL for a fixed point type is to help establish the
model numbers of the type. Since the model numbers must be representable
values of the type, and since the values of a derived type are determined by
the parent type, no representation clause is allowed for a derived fixed
point type unless the model numbers determined by the clause are
representable values. (In addition, 13.2(12) requires that the specified
value of SMALL not exceed the delta of the type.)
With respect to the example, DF1'DELTA is 4.0, so a value specified for
DF1'SMALL must not exceed 4.0. In addition, the values of DF1 include at
least the model numbers of parent subtype F1. These model numbers are -15.0,
-14.0, ..., 14.0, 15.0. If DF1'SMALL is specified to be 4.0, the mantissa
for DF1 must be 2, so the model numbers for DF1 will be -12.0, -8.0, -4.0,
| 0.0, 4.0, 8.0, and 12.0. Since these are all values of type F1, such a
specification of SMALL is allowed. If the specified value of SMALL is 3.0,
'SMALL can be specified for a derived fixed point type AI-00099/12 2
88-05-23 ra WJ
the mantissa for DF1 must be 3 (to ensure the bounds of the subtype are
within SMALL of model numbers), so the model numbers for DF1 will be -21.0,
-18.0, ..., 18.0, 21.0. If the chosen base type for F1 includes these values
(see AI-00341), then the representation clause is allowed. On the other
hand, if the base type for F1 has only four mantissa bits, then the range of
representable values is just -15.0 .. 15.0, and the representation clause for
SMALL would not be allowed.
If the representation clause for DF1'SMALL specifies 0.1, then the mantissa
of DF1 must be 8 and the model numbers for DF1 will be -25.5, -25.4, ...,
25.4, 25.5. If these model numbers are not represented exactly in the value
set for F1's base type, such a representation clause must be rejected.
These arguments are not affected by the presence of an explicit (or implicit)
representation clause for the parent type (see AI-00138).