The compiled code doesn't hold the Delta
value anywhere; stored values of the type are scaled, so the required size corresponds to the range divided by the Small
(remembering that if Delta
isn't a power of two you will need to specify Small
to be the same as Delta
).
For GNAT, it turns out that there is a minimum supported value of Delta
, and that there's a maximum Size
for objects of the type: on Mac OS X (Intel),
Small_Delta : constant := 2.0 ** (-127);
Small_Bound : constant := 2.0 ** (-64);
type T1 is delta Small_Delta range -Small_Bound .. Small_Bound;
fails with
"T1'Small" too small, minimum allowed is 2.0**(-80)
and
Larger_Delta : constant := 2.0 ** (-64);
Larger_Bound : constant := 2.0;
type T2 is delta Larger_Delta range -Larger_Bound .. Larger_Bound;
fails with
size required (67) for type "T2" too large, maximum allowed is 64
(I'm not sure why 67, not 65!)