comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Why no 'Floor for fixed point types
Date: Wed, 29 Oct 2003 13:26:30 -0600
Date: 2003-10-29T13:26:30-06:00	[thread overview]
Message-ID: <vq0569pldh9i78@corp.supernews.com> (raw)
In-Reply-To: bnmc74$137bsk$1@ID-25716.news.uni-berlin.de

"Nick Roberts" <nick.roberts@acm.org> wrote in message
news:bnmc74$137bsk$1@ID-25716.news.uni-berlin.de...
> Robert I. Eachus wrote:
>
> > ...  Trying to test even a small
> > subset of all possible reasonable values of 'Small and fixed-point
> > numbers just isn't reasonably possible without trillions of machines
> > crunching for millions of years.   So your compiler probably has
> > millions of errors in the low order bit that are just not practical to
> > find, and of no real interest to anyone anyway.
>
> So possibly a question we should ask is "If nobody cares, does it count as
> an error (or bug)?" I admit, there might be a few Intel customers who'd
> like to know the answer to that one. :-)

This is wrong (which was my original point). Ada requires such results to be
members of the "close result set", which is implementation-defined. Thus,
the only way for there to be actual "errors" or "bugs" in these result is if
we've defined that set incorrectly (implementation-defined stuff is supposed
to be documented). Of course, if it is proved that we've done that wrong,
it's highly unlikely that we'd change the compiler; just the documentation.
So in practice it means that such results have whatever accuracy the
compiler writer can easily support.

> > From experience with
> > fixed-point, the tough cases are of the form A := Fixed(B*C); where B
> > and C are of two other types than Fixed, and there is no easy
> > representation of Fixed'Small/(B_type'Small * C_type'Small).
>
> What do you mean when you say these are tough cases? The RM95 essentially
> says that the result is either of the representable values (of the type
> Fixed here) which bound the precise result.

Read G.2.3 to see what the RM says about the accuracy of fixed point. In
particular, read about the 'perfect result set' and the 'close result set'.
If you care about accuracy, you need to avoid operations which only require
a result in the 'close result set', because those are cases that the
compiler is allowed to be inaccurate.

                    Randy.






  parent reply	other threads:[~2003-10-29 19:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-23 20:09 Why no 'Floor for fixed point types Duncan Sands
2003-10-23 22:06 ` Robert I. Eachus
2003-10-24 16:00   ` Stephen Leake
2003-10-24 18:13     ` Duncan Sands
2003-10-23 23:10 ` Martin Dowie
2003-10-24 21:46 ` Nick Roberts
2003-10-25  4:29   ` Robert I. Eachus
2003-10-25 20:42     ` Nick Roberts
2003-10-25 22:40       ` Robert I. Eachus
2003-10-27 18:59         ` Randy Brukardt
2003-10-28  1:19           ` Robert I. Eachus
2003-10-28 18:23             ` Nick Roberts
2003-10-28 18:34               ` Stephane Richard
2003-10-29 19:26               ` Randy Brukardt [this message]
2003-10-30  4:55                 ` Robert I. Eachus
2003-10-28 18:10         ` Nick Roberts
2003-10-27 18:49       ` Randy Brukardt
2003-10-28 18:32         ` Nick Roberts
2003-10-29 19:29           ` Randy Brukardt
2003-10-30 23:41             ` Nick Roberts
2003-10-31 22:25               ` Randy Brukardt
2003-11-06  2:41                 ` Nick Roberts
replies disabled

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