From: westley%planck.uucp@acsu.buffalo.edu (Terry J. Westley)
Subject: determining the next model number >= any arbitrary number
Date: 2 Jan 91 15:24:18 GMT [thread overview]
Message-ID: <1991Jan2.152418.11783@planck.uucp> (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
next reply other threads:[~1991-01-02 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-01-02 15:24 Terry J. Westley [this message]
1991-01-02 16:23 ` determining the next model number >= any arbitrary number Robert Firth
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox