Model numbers for a fixed point subtype with length clause AI-00146/10 1
88-05-23 ra WJ
| !standard 03.05.09 (16) 88-05-23 AI-00146/10
!standard 03.05.09 (14)
!class ramification 86-11-14
| !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 (6-0-0) 86-11-14 (pending editorial review)
!status work-item 86-05-20
!status referred back to committee by WG9 86-05-09
!status committee-approved (8-1-0) 85-11-20
!status work-item 85-04-08
!status received 84-01-10
!references 83-00238, 83-00738, 83-00805
!topic Model numbers for a fixed point subtype with length clause
!summary 85-04-08
If a length clause specifying SMALL has been given for a fixed point type, T,
then the value of SMALL for any subtype of T is given by T'SMALL.
!question 86-12-17
3.5.9(16), which is a note, says:
If S is a subtype of a fixed point type or subtype T, then the
set of model numbers of S is a subset of those of T. If a length
clause has been given for T, then both S and T have the same
value for SMALL.
3.5.9(14) defines how model numbers are defined for a fixed point subtype:
[The elaboration of a fixed point subtype indication] creates a
fixed point subtype whose model numbers are defined by the
corresponding fixed point constraint and also by the length
clause specifying small, if there is one.
Now consider an example:
type F is delta 0.1 range -15.0 .. 15.0;
for F'SMALL use 0.1;
subtype FS is F delta 0.8;
There is no length clause specified for subtype FS and none is allowed. What
is the value of FS'SMALL?
!response 87-03-13
Since a length clause cannot be given for a subtype declared by a subtype
declaration (see 13.2(3)), when 3.5.9(14) mentions "the" length clause
| specifying SMALL, it can only be referring to a length clause given for a
declared type. 3.5.9(5) then defines how such a length clause determines the
model numbers and the value of SMALL:
Model numbers for a fixed point subtype with length clause AI-00146/10 2
88-05-23 ra WJ
For the model numbers defined by a fixed point constraint, the
| number SMALL is chosen as the largest power of two that is not
greater than the delta of the fixed accuracy definition.
| Alternatively, it is possible to specify the value of SMALL by a
length clause, in which case model numbers are multiples of the
specified value.
Consequently, if a length clause is given for the declared type, F, the
| clause defines the value of SMALL for all subtypes of F, in accordance with
3.5.9(5).
Although the value of SMALL is fixed by a length clause, the length of the
mantissa, and hence, the set of model numbers, can change for a subtype:
subtype FS3 is F delta 0.8 range -7.0 .. 7.0;
F'MANTISSA = FS'MANTISSA, but since FS3 has half the range of F, FS3'MANTISSA
= F'MANTISSA - 1.