File: AA-3-5-9.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (336 lines) | stat: -rw-r--r-- 25,458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Fixed Point Types</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-5-8.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-5-10.html">Next</A></P>
<HR>
<H1> 3.5.9 Fixed Point Types</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1768"></A><A NAME="I1769"></A><A NAME="I1770"></A>A
fixed point type is either an ordinary fixed point type, or a decimal
fixed point type. <A NAME="I1771"></A>The error bound of a fixed point
type is specified as an absolute value, called the <I>delta</I> of the
fixed point type. </DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">fixed_point_definition<A NAME="I1772"></A>
::= </FONT><A NAME="I1773"></A><FONT FACE="Arial, Helvetica">ordinary_fixed_point_definition</FONT>&nbsp;|&nbsp;<A NAME="I1774"></A><FONT FACE="Arial, Helvetica">decimal_fixed_point_definition</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">ordinary_fixed_point_definition<A NAME="I1775"></A>
::= </FONT><BR>
&nbsp;&nbsp;&nbsp;<B>delta</B>&nbsp;<I>static_</I><A NAME="I1776"></A><FONT FACE="Arial, Helvetica">expression</FONT>&nbsp;&nbsp;<A NAME="I1777"></A><FONT FACE="Arial, Helvetica">real_range_specification</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">decimal_fixed_point_definition<A NAME="I1778"></A>
::= </FONT><BR>
&nbsp;&nbsp;&nbsp;<B>delta</B>&nbsp;<I>static_</I><A NAME="I1779"></A><FONT FACE="Arial, Helvetica">expression</FONT>&nbsp;<B>digits</B>&nbsp;<I>static_</I><A NAME="I1780"></A><FONT FACE="Arial, Helvetica">expression</FONT>&nbsp;[<A NAME="I1781"></A><FONT FACE="Arial, Helvetica">real_range_specification</FONT>]</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">digits_constraint<A NAME="I1782"></A>
::= </FONT><BR>
&nbsp;&nbsp;&nbsp;<B>digits</B>&nbsp;<I>static_</I><A NAME="I1783"></A><FONT FACE="Arial, Helvetica">expression</FONT>&nbsp;[<A NAME="I1784"></A><FONT FACE="Arial, Helvetica">range_constraint</FONT>]</DIV>

<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1785"></A>For a type defined by a <FONT FACE="Arial, Helvetica">fixed_point_definition</FONT>,
the <I>delta</I> of the type is specified by the value of the <FONT FACE="Arial, Helvetica">expression</FONT>
given after the reserved word <B>delta</B>; this <FONT FACE="Arial, Helvetica">expression</FONT>
is expected to be of any real type. <A NAME="I1786"></A><A NAME="I1787"></A><A NAME="I1788"></A>For
a type defined by a <FONT FACE="Arial, Helvetica">decimal_fixed_point_definition</FONT>
(a <I>decimal</I> fixed point type), the number of significant decimal
digits for its first subtype (the <I>digits</I> of the first subtype)
is specified by the <FONT FACE="Arial, Helvetica">expression</FONT> given
after the reserved word <B>digits</B>; this <FONT FACE="Arial, Helvetica">expression</FONT>
is expected to be of any integer type. </DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;In a <FONT FACE="Arial, Helvetica">fixed_point_definition</FONT>
or <FONT FACE="Arial, Helvetica">digits_constraint</FONT>, the <FONT FACE="Arial, Helvetica">expression</FONT>s
given after the reserved words <B>delta</B> and <B>digits</B> shall be
static; their values shall be positive.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1789"></A>The set of values of a fixed
point type comprise the integral multiples of a number called the <I>small</I>
of the type. <A NAME="I1790"></A>For a type defined by an <FONT FACE="Arial, Helvetica">ordinary_fixed_point_definition</FONT>
(an <I>ordinary</I> fixed point type), the <I>small</I> may be specified
by an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
(see <A HREF="AA-13-3.html">13.3</A>); if so specified, it shall be no
greater than the <I>delta</I> of the type. If not specified, the <I>small</I>
of an ordinary fixed point type is an implementation-defined power of
two less than or equal to the <I>delta</I>. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
<I>small</I> of an ordinary fixed point type.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;For a decimal fixed point type, the <I>small</I>
equals the <I>delta</I>; the <I>delta</I> shall be a power of 10. If
a <FONT FACE="Arial, Helvetica">real_range_specification</FONT> is given,
both bounds of the range shall be in the range -(10**<I>digits</I>-1)*<I>delta</I>
.. +(10**<I>digits</I>-1)*<I>delta</I>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;A <FONT FACE="Arial, Helvetica">fixed_point_definition</FONT>
is illegal if the implementation does not support a fixed point type
with the given <I>small</I> and specified range or <I>digits</I>. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>What
combinations of <I>small</I>, range, and <I>digits</I> are supported
for fixed point types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;For a <FONT FACE="Arial, Helvetica">subtype_indication</FONT>
with a <FONT FACE="Arial, Helvetica">digits_constraint</FONT>, the <FONT FACE="Arial, Helvetica">subtype_mark</FONT>
shall denote a decimal fixed point subtype. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>Or, as an
obsolescent feature, a floating point subtype is permitted -- see <A HREF="AA-J-3.html">J.3</A>.
</FONT></DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1791"></A>The base range (see <A HREF="AA-3-5.html">3.5</A>)
of a fixed point type is symmetric around zero, except possibly for an
extra negative value in some implementations.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1792"></A>An
<FONT FACE="Arial, Helvetica">ordinary_fixed_point_definition</FONT>
defines an ordinary fixed point type whose base range includes at least
all multiples of <I>small</I> that are between the bounds specified in
the <FONT FACE="Arial, Helvetica">real_range_specification</FONT>. The
base range of the type does not necessarily include the specified bounds
themselves. <A NAME="I1793"></A><A NAME="I1794"></A>An <FONT FACE="Arial, Helvetica">ordinary_fixed_point_definition</FONT>
also defines a constrained first subtype of the type, with each bound
of its range given by the closer to zero of: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>the value of the conversion to the fixed point type of
the corresponding <FONT FACE="Arial, Helvetica">expression</FONT> of
the <FONT FACE="Arial, Helvetica">real_range_specification</FONT>; <A NAME="I1795"></A></LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>14.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B><U>The conversion
mentioned above is not an <I>implicit subtype conversion</I> (which is
something that happens at overload resolution, see <A HREF="AA-4-6.html">4.6</A>),
although it happens implicitly. Therefore, the freezing rules are not
invoked on the type (which is important so that representation items
can be given for the type). <A NAME="I1796"></A></U></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>the corresponding bound of the base range. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1797"></A>A <FONT FACE="Arial, Helvetica">decimal_fixed_point_definition</FONT>
defines a decimal fixed point type whose base range includes at least
the range -(10**<I>digits</I>-1)*<I>delta</I> .. +(10**<I>digits</I>-1)*<I>delta</I>.
<A NAME="I1798"></A><A NAME="I1799"></A>A <FONT FACE="Arial, Helvetica">decimal_fixed_point_definition</FONT>
also defines a constrained first subtype of the type. If a <FONT FACE="Arial, Helvetica">real_range_specification</FONT>
is given, the bounds of the first subtype are given by a conversion of
the values of the <FONT FACE="Arial, Helvetica">expression</FONT>s of
the <FONT FACE="Arial, Helvetica">real_range_specification</FONT>. <A NAME="I1800"></A>Otherwise,
the range of the first subtype is -(10**<I>digits</I>-1)*<I>delta</I>
.. +(10**<I>digits</I>-1)*<I>delta</I>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B><U>The conversion
mentioned above is not an <I>implicit subtype conversion</I> (which is
something that happens at overload resolution, see <A HREF="AA-4-6.html">4.6</A>),
although it happens implicitly. Therefore, the freezing rules are not
invoked on the type (which is important so that representation items
can be given for the type). <A NAME="I1801"></A></U></FONT></DIV>

<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1802"></A>The elaboration of a <FONT FACE="Arial, Helvetica">fixed_point_definition</FONT>
creates the fixed point type and its first subtype.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;For a <FONT FACE="Arial, Helvetica">digits_constraint</FONT>
on a decimal fixed point subtype with a given <I>delta</I>, if it does
not have a <FONT FACE="Arial, Helvetica">range_constraint</FONT>, then
it specifies an implicit range -(10**<I>D</I>-1)*<I>delta</I> .. +(10**<I>D</I>-1)*<I>delta</I>,
where <I>D</I> is the value of the <FONT FACE="Arial, Helvetica">expression</FONT>.
<A NAME="I1803"></A>A <FONT FACE="Arial, Helvetica">digits_constraint</FONT>
is <I>compatible</I> with a decimal fixed point subtype if the value
of the <FONT FACE="Arial, Helvetica">expression</FONT> is no greater
than the <I>digits</I> of the subtype, and if it specifies (explicitly
or implicitly) a range that is compatible with the subtype. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Except for
the requirement that the <I>digits</I> specified be no greater than the
<I>digits</I> of the subtype being constrained, a <FONT FACE="Arial, Helvetica">digits_constraint</FONT>
is essentially equivalent to a <FONT FACE="Arial, Helvetica">range_constraint</FONT>.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.b</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>Consider
the following example: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.c</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>type</B>&nbsp;D&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;0.01&nbsp;<B>digits</B>&nbsp;7&nbsp;<B>range</B>&nbsp;-0.00&nbsp;..&nbsp;9999.99;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.d/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The compatibility rule implies
that the <FONT FACE="Arial, Helvetica">digits_constraint</FONT> &quot;<B>digits</B>
6&quot; specifies an implicit range of &quot;-<U>9999.99</U><S>99.9999</S>
.. <U>9999.99</U><S>99.9999</S>&quot;. Thus, &quot;<B>digits</B> 6&quot;
is not compatible with the constraint of D, but &quot;<B>digits</B> 6
range 0.00 .. 9999.99&quot; is compatible.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>A value of a scalar type belongs
to a constrained subtype of the type if it belongs to the range of the
subtype. Attributes like Digits and Delta have no affect on this fundamental
rule. So the obsolescent forms of <FONT FACE="Arial, Helvetica">digits_constraint</FONT>s
and <FONT FACE="Arial, Helvetica">delta_constraint</FONT>s that are called
``accuracy constraints'' in RM83 don't really represent constraints on
the values of the subtype, but rather primarily affect compatibility
of the ``constraint'' with the subtype being ``constrained.'' In this
sense, they might better be called ``subtype assertions'' rather than
``constraints.''</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note that the <FONT FACE="Arial, Helvetica">digits_constraint</FONT>
on a decimal fixed point subtype is a combination of an assertion about
the <I>digits</I> of the subtype being further constrained, and a constraint
on the range of the subtype being defined, either explicit or implicit.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1804"></A>The elaboration of a <FONT FACE="Arial, Helvetica">digits_constraint</FONT>
consists of the elaboration of the <FONT FACE="Arial, Helvetica">range_constraint</FONT>,
if any. <A NAME="I1805"></A><A NAME="I1806"></A>If a <FONT FACE="Arial, Helvetica">range_constraint</FONT>
is given, a check is made that the bounds of the range are both in the
range -(10**<I>D</I>-1)*<I>delta</I> .. +(10**<I>D</I>-1)*<I>delta</I>,
where <I>D</I> is the value of the (static) <FONT FACE="Arial, Helvetica">expression</FONT>
given after the reserved word <B>digits</B>. <A NAME="I1807"></A>If this
check fails, Constraint_Error is raised. </DIV>

<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;The implementation shall support at least 24
bits of precision (including the sign bit) for fixed point types. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This is sufficient
to represent Standard.Duration with a <I>small</I> no more than 50 milliseconds.
</FONT></DIV>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;Implementations are permitted to support only
<I>small</I>s that are a power of two. In particular, all decimal fixed
point type declarations can be disallowed. Note however that conformance
with the Information Systems Annex requires support for decimal <I>small</I>s,
and decimal fixed point type declarations with <I>digits</I> up to at
least 18. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>The
accuracy requirements for multiplication, division, and conversion (see
<A HREF="AA-G-2-1.html">G.2.1</A>, ``<A HREF="AA-G-2-1.html">Model of
Floating Point Arithmetic</A>'') are such that support for arbitrary
<I>small</I>s should be practical without undue implementation effort.
Therefore, implementations should support fixed point types with arbitrary
values for <I>small</I> (within reason). One reasonable limitation would
be to limit support to fixed point types that can be converted to the
most precise floating point type without loss of precision (so that Fixed_IO
is implementable in terms of Float_IO). </FONT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="Notes" Style="margin-bottom: 0.4em"><FONT SIZE=-1>36&nbsp;&nbsp;The
base range of an ordinary fixed point type need not include the specified
bounds themselves so that the range specification can be given in a natural
way, such as: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;&nbsp;<B>type</B>&nbsp;Fraction&nbsp;<B>is&nbsp;delta</B>&nbsp;2.0**(-15)&nbsp;<B>range</B>&nbsp;-1.0&nbsp;..&nbsp;1.0;<BR>
&nbsp;&nbsp;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>With 2's complement hardware, such a
type could have a signed 16-bit representation, using 1 bit for the sign
and 15 bits for fraction, resulting in a base range of -1.0 .. 1.0-2.0**(-15).
</FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of
fixed point types and subtypes:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Volt&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;0.125&nbsp;<B>range</B>&nbsp;0.0&nbsp;..&nbsp;255.0;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Examples"><TT>&nbsp;&nbsp;<I>--&nbsp;&nbsp;A&nbsp;pure&nbsp;fraction&nbsp;which&nbsp;requires&nbsp;all&nbsp;the&nbsp;available</I><BR>
&nbsp;&nbsp;<I>--&nbsp;&nbsp;space&nbsp;in&nbsp;a&nbsp;word&nbsp;can&nbsp;be&nbsp;declared&nbsp;as&nbsp;the&nbsp;type&nbsp;Fraction:</I><BR>
<B>type</B>&nbsp;Fraction&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;System.Fine_Delta&nbsp;<B>range</B>&nbsp;-1.0&nbsp;..&nbsp;1.0;<BR>
&nbsp;&nbsp;<I>--&nbsp;&nbsp;Fraction'Last&nbsp;=&nbsp;1.0&nbsp;-&nbsp;System.Fine_Delta</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Money&nbsp;<B>is</B>&nbsp;<B>delta</B>&nbsp;0.01&nbsp;<B>digits</B>&nbsp;15;&nbsp;&nbsp;<I>--&nbsp;decimal&nbsp;fixed&nbsp;point</I><BR>
<B>subtype</B>&nbsp;Salary&nbsp;<B>is</B>&nbsp;Money&nbsp;<B>digits</B>&nbsp;10;<BR>
&nbsp;&nbsp;<I>--&nbsp;Money'Last&nbsp;=&nbsp;10.0**13&nbsp;-&nbsp;0.01,&nbsp;Salary'Last&nbsp;=&nbsp;10.0**8&nbsp;-&nbsp;0.01</I></TT></DIV>

<H4 ALIGN=CENTER>Inconsistencies With Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1808"></A>In Ada 95,
S'Small always equals S'Base'Small, so if an implementation chooses a
<I>small</I> for a fixed point type smaller than required by the <I>delta</I>,
the value of S'Small in Ada 95 might not be the same as it was in Ada
83. </FONT></DIV>

<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1809"></A>Decimal fixed
point types are new, though their capabilities are essentially similar
to that available in Ada 83 with a fixed point type whose <I>small</I>
equals its <I>delta</I> equals a power of 10. However, in the Information
Systems Annex, additional requirements are placed on the support of decimal
fixed point types (e.g. a minimum of 18 digits of precision). </FONT></DIV>

<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The syntax rules for <FONT FACE="Arial, Helvetica">fixed_point_constraint</FONT>
and <FONT FACE="Arial, Helvetica">fixed_accuracy_definition</FONT> are
removed. The syntax rule for <FONT FACE="Arial, Helvetica">fixed_point_definition</FONT>
is new. A syntax rule for <FONT FACE="Arial, Helvetica">delta_constraint</FONT>
is included in the Obsolescent features (to be compatible with Ada 83's
<FONT FACE="Arial, Helvetica">fixed_point_constraint</FONT>). </FONT></DIV>

<HR>
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-5-8.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-3-5-10.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>