The 'Succ
and 'Pred
attributes can be used on floating-point values to return the next or previous machine numbers. If T
is a floating-point type,
T'Succ(X)
is the smallest floating-point "machine number" > X
, and
T'Pred(X)
is the largest floating-point machine number < X
. Thus:
type Works is digits 6 range 0.0 .. 42.0;
subtype Exclusive is Works range 0.0 .. Works'Pred(42.0);
Or (since the range on the type
declaration might not be relevant):
type Digits_6 is digits 6;
subtype Exclusive is Digits_6 range 0.0 .. Digits_6'Pred(42.0);
Or
type Exclusive is digits 6 range 0.0 .. Float'Pred(42.0);
assuming you know Float
is a 32-bit IEEE float and Exclusive
will also be one.