comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Why no 'Floor for fixed point types
Date: Mon, 27 Oct 2003 12:59:40 -0600
Date: 2003-10-27T12:59:40-06:00	[thread overview]
Message-ID: <vpqqs0idq405e8@corp.supernews.com> (raw)
In-Reply-To: 3F9AFB67.5080401@comcast.net

"Robert I. Eachus" <rieachus@comcast.net> wrote in message
news:3F9AFB67.5080401@comcast.net...
> But you didn't pay attention above.  The compiler allows you to think
> about fixed-point types as if they are real (non-integer) values.  But
> they are not implemented that way.  Any compiler that uses
> floating-point arithmetic to do fixed-point computations has a lot of
> bugs in it.   They just havent been found yet.  (And I think it was ACVC
> 1.4 that added a lot of tests which found such bugs.)

As usual with blanket statements, this is wrong. Janus/Ada in fact does use
floating-point arithmetic to implement fixed point in some cases (especially
the mixed multiply). We did the error analysis on these operations, and they
are fine - they'll get the right answer in all cases that Ada 95 requires
that. (There are some cases where no technique will get the "right" answer
as defined in Ada 83, and those of course we might get wrong for some bit
patterns. Many Ada 83 compilers simply avoided the issue by restricting
'Small to powers of two, which of course is trivial to get right. And rather
restrictive.) Since, in a generic, you don't know the 'Smalls involved, and
you don't know the magatude of the values, there isn't much else to do
except use the highest precision math that you have available. As with
everything, it depends on how you use it.

                        Randy.

                   Randy.






  reply	other threads:[~2003-10-27 18:59 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 [this message]
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
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