From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 2 May 93 11:59:33 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!ira.u ka.de!math.fu-berlin.de!dww@ucbvax.Berkeley.EDU (Debora Weber-Wulff) Subject: Re: FIXED bug in Medidian 4.1.1? Message-ID: <1S4CB39P@math.fu-berlin.de> List-Id: dewar@schonberg.NYU.EDU (Robert Dewar) writes: >Well I am not sure that this kind of tutorial is an appropriate use of >comp.lang.ada bandwidth (this sort of question about fixed point should be >dealt with in the FAQ, and then people referred there when they ask about it) That would be great to include this sort of question there, as there are many confusing corners in Ada. > >When you give a fixed point declaration where the end points are not model >numbers, it is not only allowed but *required* that the end points be >excluded from the representable range. It is thus not only allowable, but >required behavior that use of the end point values in this situation will >cause Constraint_Error. Can you please quote chapter and verse on that? I have tried *often* to make sense of 3.5.9 - which paragraph encodes this requirement? > >The Meridian compiler is behaving according to the RM, and thus the subject >heading in this thread is incorrect, and the answer to the question mark at th e >end of it is NO! I would suggest that people reserve the use of the word bug, >until they find out what is going on -- "Query regarding fixed point" would >have been a more appropriate title for the original posting. Well, it *is* a bug, because when I use a length clause, I get sensible answers, i.e. reading in 1.99 returns 1.99 and not 1.98, but I still get a data_error "value 0 out of range 15..300" when I enter any value from 0.15 (the lower bound) upto and including 0.99. Any range that does not include 0.0 will raise this "error" upon reading in a value with 0 before the decimal point. If I include 0.0, the construct works as expected. If this is not a bug, *please* explain! > >Meanwhile, follow these simple suggestions for avoiding running into problems >with fixed-point. > > > 1. Always make the end point values a multiple of the declared delta valu e Well, we did. The delta was 0.01, and 0.15 is 15 times 0.01. > > 2. If the declared delta is not a power of 2, always put in a small > declaration, of the form: > for Fixed_Type'Small use 0.01; Okay, will do. What was the logic behind this - to make it easier to use or to make it easier to compile? As I mentioned in a private correspondence with you on this, Richard, I'm just an old COBOL hacker that uses decimal representations for many things. My students and I have been trying to program about the height of a person in meters (thus the 0.15 .. 3.00, although 2.72 suffices, according to Guinness) and about interest calculation in DM and pf. I'd been advised before to avoid FIXED if I don't understand it, but I'm just pig-headed :-), if it's there I want to use it and I want it to make sense :-) :-) Anyway, thanks to all for the assistance provided. -- Debora Weber-Wulff, Professorin fuer Softwaretechnik snail: Technische Fachhochschule Berlin, FB Informatik, Luxemburgerstr. 10, 1000 Berlin 65 email: dww@informatik.tfh-berlin.dbp.de