comp.lang.ada
 help / color / mirror / Atom feed
From: gwinn@res.ray.com (Joe Gwinn)
Subject: Re: fixed point vs floating point
Date: 1997/12/01
Date: 1997-12-01T00:00:00+00:00	[thread overview]
Message-ID: <gwinn-0112971904460001@dh5055193.res.ray.com> (raw)
In-Reply-To: dewar.881006262@merv


In article <dewar.881006262@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) wrote:

> Joe said
> 
> <<Who said we expected Ada83 fixed point types to solve all problems?  What
> we hoped for was that conversion between scalings and normalizations after
> arithmetic would be handled, and they weren't.  This, one could expect a
> language to do.>>
> 
> Well we are still unclear as to what are language issues here, and what
> are issues of bad implementation (i.e. bugs or bad implemenation choices
> in the compiler), and so are you :-) In fact we still have no convincing
> evidence that there were *any* compiler problems from what you have recalled
> so far.

I neither know nor care if this is an Ada language design issue.  I don't
buy and use language designs or even languages, I buy and use compilers. 
It doesn't much matter if we are today convinced or not; the decision was
made then, based on the compilers then available.  It may be different
today, but I don't see many people using fixed point where floating point
is available.


> As to expecting the language to do scaling autoamtically, I think this is
> a mistake for fixed-point. PL/1 tried and failed, and COBOL certainly
> does not succeed (a common coding rule in COBOL is never to use the
> COMPUTE verb, precisely because the scaling is not well defined).

Whoa.  Read my words again.  "Scalings" are nouns, not verbs.  In this
context, a "scaling" is the (human) decision of where to put the binary
point, and what the value of the least significant bit shall be.  Scalings
are static, done as part of code design, and documented in Interface
Control Documents and Interface Design Documents.  Remember, this is 1960s
era stuff.  

This information can in theory be declared to a suitably designed
compiler, which can then deal with the details of normalization, a boring
mechanical process that humans aren't very good at.  


> I think any attempt to automatically determine the scaling of intermediate
> results in multiplications and divisions in fixed-point is doomed to failure.
> This just *has* to be left up to the programmer, since it is highly
> implementation dependent.

No, it isn't hopeless.  It's quite simple and mechanical, actually.  If it
were imposssible, why then did Ada83 attempt it?  It's exactly the same
rules we were taught in grade school for the handling of decimal points
after arithmetic on decimals, especially multiplication and division. 
Ada83 should have been able to do it, given the information provided when
the various variables types were defined.


> I have no idea what you mean by "normalizations". This term makes no sense
> to me at all in a fixed-point context.

Normalization is also known as rescaling, typically done by right-shifting
the result of a multiplication to put the binary point back where it
belongs in the desired output variable's scaling.  A rounding may also be
done.

Joe Gwinn




  reply	other threads:[~1997-12-01  0:00 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-22  0:00 fixed point vs floating point 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             ` 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 [this message]
1997-12-03  0:00                           ` robin
1997-11-25  0:00             ` Matthew Heaney
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
  -- strict thread matches above, loose matches on Subject: below --
2011-09-29 10:25 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
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     ` robin
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-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
     [not found] <9711221603.AA03295@nile.gnat.com>
1997-11-22  0:00 ` Ken Garlington
replies disabled

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