westley%planck.uucp@acsu.buffalo.edu (Terry J. Westley) (01/02/91)
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
firth@sei.cmu.edu (Robert Firth) (01/03/91)
In article <1991Jan2.152418.11783@planck.uucp> westley%planck.uucp@acsu.buffalo.edu (Terry J. Westley) writes: >Since 100.0 cannot be exactly expressed in a binary floating point >representation Sure can. (sign => 0, exponent => 2#111#, mantissa => 2#0.11001#)