* determining the next model number >= any arbitrary number
@ 1991-01-02 15:24 Terry J. Westley
1991-01-02 16:23 ` Robert Firth
0 siblings, 1 reply; 2+ messages in thread
From: Terry J. Westley @ 1991-01-02 15:24 UTC (permalink / raw)
Given the following:
type PERCENTAGE is digits 6 range 0.0..110.0;
Since 100.0 cannot be exactly expressed in a binary floating point
representation (available on most modern machines), then the following
must yield a model number less than or greater than 100.0, never exactly
100.0.
Complete : PERCENTAGE := 100.0;
I don't believe the RM says anything about which an implementation must
pick.
So, how can I guarantee that this assignment will always yield a value
greater than or equal to 100.0?
Maybe:
Complete : PERCENTAGE := 100.0 + PERCENTAGE'small;
But, since 'small is so "small," I can't depend on this for any
arbitrary assignment, especially when the assigned value is
significantly larger than 'small.
What I really want is something more like the following:
Complete : PERCENTAGE := 100.0 + PERCENTAGE'epsilon(100.0);
if only epsilon were defined to accept a parameter instead of simply
returning the size of the model number interval around 1.0.
Any ideas on how can this could be done?
--
--
Terry J. Westley
Arvin/Calspan Advanced Technology Center
P.O. Box 400, Buffalo, NY 14225
westley%planck.uucp@acsu.buffalo.edu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1991-01-02 16:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-01-02 15:24 determining the next model number >= any arbitrary number Terry J. Westley
1991-01-02 16:23 ` Robert Firth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox