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: 29 Apr 93 15:18:46 GMT From: netnews!schonberg!dewar@nyu.edu (Robert Dewar) Subject: Re: FIXED bug in Medidian 4.1.1? Message-ID: List-Id: 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) However, since there was a follow-up which was incorrect, it needs correcting. 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. 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 the 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. 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 value 2. If the declared delta is not a power of 2, always put in a small 2. declaration, of the form: for Fixed_Type'Small use 0.01; where the value is the same as the declared delta value. Your compiler may reject this representation clause, in which case it just can't handle this choice of delta. If it accepts it, then everything should work as expected. Put the Small declaration right after the fixed point declaration (this avoids some other curiosities that I don't want to describe in detail)