comp.lang.ada
 help / color / mirror / Atom feed
From: Ken Garlington <kennieg@flash.net>
To: chat@gnat.com
Subject: Re: fixed point vs floating point
Date: 1997/11/22
Date: 1997-11-22T00:00:00+00:00	[thread overview]
Message-ID: <34776A06.5855@flash.net> (raw)
In-Reply-To: 9711221603.AA03295@nile.gnat.com


Robert Dewar wrote:
> 
> <<The primary reason we use floating point and not fixed point is that
> fixed point is, to us, unreliable.  By that I mean the ultimate result
> is not what we want.  We agree that fixed point is much faster, but
> floating point is, almost always, plenty fast enough.>>
> 
> *very odd*
> 
> First, please do some experiments, all of those who believe that fixed-point
> is faster than floating-point. Especially if you include some multiplications,
> and especially if you are using precisions greater than 32 bits on a 32-bit
> machine, you are going to be MIGHTY surprised, I would even say schocked
> by what you see. Fixed point arithmetic other than very simple adition
> and subtraction of identical types (which is the same speed as fpt on
> typical machines) is drastically slower than floating-point. If you don't
> believe me, try it out and see!

This is probably true if you include your earlier qualifier - on
"modern"
architectures. On MIL-STD-1750s, however, most implementations have far
more
clock cycles required for floating-point multiplies and divides than for
integer shifts -- on the order of 30-50 cycles for the floats vs. 5-8
for
the shifts. There is also a penalty if you're dealing with slow memory,
and
having to fetch the 32-bit float vs. the 16-bit integer. So, IF...

- you can live with the precision of 16 bits, AND
- you use power-of-two deltas, AND
- you have an Ada compiler that optimizes well for fixed-point

you could get better performance for fixed-point. I was on a project
where
one team used fixed-point extensively, and another used mostly
floating-point.
The fixed-point and floating-point appeared to be about the same
performance-wise,
mostly because the Ada 83 compiler used did not do a lot of fixed-point
optimization.

> Second, fixed-point is FAR more reliable in practice, because as Bob
> Eachus notes, the error analysis is far simpler. Mars seems to say that
> fixed-point is unreliable because off incompetent programmers and
> unreliable compilers, but this is a comment on a particular set of
> incopmpetent programmers and unrealiable compilers, not on the fundamental
> nature of fixed vs floating-point.

We did notice incorrect object code for fixed-point generated by our
compiler
for fixed-point, but I agree that fixed-point is more reliable in the
abstract.

> In my experience programmers are woefully ignorant about floating-point
> (the completely extraordinary thread on CLA), and this leads to a lot of
> serious problems in floating-point code.
> 
> Interestingly in high critical systens, the objection to fpt is related
> to Mars' concern about reliability. The general perception is that fpt
> hardware is too complex to be reliable. Intels' widely publicized
> difficulties in this area can only help to confirm this worry!

We've never had anyone raise this objection in our systems, although I
have
yet to use a 1750 CPU that didn't have a bug in its floating point
implementation. I guess its due to the "obvious" fact that hardware is
more
reliable than software :)




       reply	other threads:[~1997-11-22  0:00 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9711221603.AA03295@nile.gnat.com>
1997-11-22  0:00 ` Ken Garlington [this message]
2011-09-29 10:25 fixed point vs floating point RasikaSrinivasan@gmail.com
2011-09-29 10:49 ` AdaMagica
2011-09-29 13:38   ` Martin
2011-09-30 10:17 ` Stephen Leake
2011-09-30 16:25   ` tmoran
2011-09-30 16:52     ` Dmitry A. Kazakov
2011-10-01 11:09     ` Stephen Leake
2011-09-30 19:26   ` tmoran
2011-09-30 22:31   ` tmoran
2011-10-01 13:37   ` RasikaSrinivasan@gmail.com
2011-10-02 14:19     ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
1997-12-02  0:00 Robert Dewar
1997-12-02  0:00 ` Joe Gwinn
1997-12-02  0:00   ` Ken Garlington
1997-12-03  0:00     ` Joe Gwinn
1997-12-04  0:00       ` Robert Dewar
1997-12-04  0:00         ` Shmuel (Seymour J.) Metz
1997-12-02  0:00   ` Robert Dewar
1997-12-02  0:00     ` Matthew Heaney
1997-12-03  0:00       ` Robert Dewar
1997-12-03  0:00     ` Shmuel (Seymour J.) Metz
1997-12-03  0:00       ` Robert Dewar
1997-12-03  0:00       ` Matthew Heaney
1997-12-04  0:00         ` Shmuel (Seymour J.) Metz
1997-12-04  0:00           ` Robert Dewar
1997-12-03  0:00       ` Robert Dewar
1997-12-03  0:00     ` robin
1997-12-03  0:00       ` Robert Dewar
1997-12-03  0:00 ` robin
1997-11-28  0:00 tmoran
1997-11-28  0:00 ` Robert Dewar
1997-11-27  0:00 tmoran
1997-11-27  0:00 ` Robert Dewar
1997-11-29  0:00   ` Tarjei T. Jensen
1997-11-22  0:00 Matthew Heaney
1997-11-22  0:00 ` Tucker Taft
1997-11-22  0:00   ` Robert Dewar
1997-11-22  0:00     ` Matthew Heaney
1997-11-23  0:00 ` Geert Bosch
1997-11-23  0:00   ` Matthew Heaney
1997-11-23  0:00     ` Robert Dewar
1997-11-24  0:00       ` Herman Rubin
1997-11-24  0:00         ` Robert Dewar
1997-11-25  0:00           ` Joe Gwinn
1997-11-25  0:00             ` Matthew Heaney
1997-11-25  0:00             ` Robert Dewar
1997-11-25  0:00               ` Joe Gwinn
1997-11-25  0:00                 ` Robert Dewar
1997-11-26  0:00                   ` Joe Gwinn
1997-11-26  0:00                     ` Robert Dewar
1997-12-01  0:00                       ` Joe Gwinn
1997-12-01  0:00                         ` Robert Dewar
1997-12-01  0:00                           ` Joe Gwinn
1997-12-03  0:00                           ` robin
1997-11-26  0:00             ` William A Whitaker
1997-11-24  0:00     ` Geert Bosch
1997-11-23  0:00   ` Tom Moran
1997-11-25  0:00     ` John A. Limpert
1997-11-25  0:00       ` Robert Dewar
1997-11-25  0:00       ` Robert Dewar
1997-11-24  0:00 ` Vince Del Vecchio
1997-11-24  0:00 ` Vince Del Vecchio
1997-12-03  0:00 ` robin
replies disabled

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