J.3 Reduced Accuracy Subtypes
A
digits_constraint
may be used to define a floating point subtype with a new value for its
requested decimal precision, as reflected by its Digits attribute. Similarly,
a
delta_constraint
may be used to define an ordinary fixed point subtype with a new value
for its
delta, as reflected by its Delta attribute.
Discussion: It might be more direct to
make these attributes specifiable via an
attribute_definition_clause,
and eliminate the syntax for these
_constraints.
Syntax
Name Resolution Rules
Legality Rules
Static Semantics
Dynamic Semantics
{compatibility (delta_constraint
with an ordinary fixed point subtype) [partial]} A
delta_constraint
is
compatible with an ordinary fixed point subtype if the value
of the
expression
is no less than the
delta of the subtype, and the
range_constraint,
if any, is compatible with the subtype.
{compatibility (digits_constraint
with a floating point subtype) [partial]} A
digits_constraint
is
compatible with a floating point subtype if the value of the
expression
is no greater than the requested decimal precision of the subtype, and
the
range_constraint,
if any, is compatible with the subtype.
Reason: A numeric subtype is considered
“constrained” only if a range constraint applies to it. The
only effect of a
digits_constraint
or a
delta_constraint
without a
range_constraint
is to specify the value of the corresponding Digits or Delta attribute
in the new subtype. The set of values of the subtype is not “constrained”
in any way by such
_constraints.
Wording Changes from Ada 83
In Ada 83, a
delta_constraint
is called a fixed_point_constraint, and a
digits_constraint
is called a floating_point_constraint. We have adopted other terms because
digits_constraints
apply primarily to decimal fixed point types now (they apply to floating
point types only as an obsolescent feature).