comp.lang.ada
 help / color / mirror / Atom feed
From: netnews!schonberg!dewar@nyu.edu  (Robert Dewar)
Subject: Re: FIXED bug in Medidian 4.1.1?
Date: 29 Apr 93 15:18:46 GMT	[thread overview]
Message-ID: <dewar.736096726@schonberg> (raw)

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)

             reply	other threads:[~1993-04-29 15:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-04-29 15:18 Robert Dewar [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-05-04  4:05 FIXED bug in Medidian 4.1.1? Robert Dewar
1993-05-03 13:50 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!noc.n
1993-05-02 11:59 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!ira.u
1993-04-30 10:33 Keith Thompson @pulsar
1993-04-28 14:32 Ron Sercely
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox