comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: fixed point vs floating point
Date: Sat, 01 Oct 2011 07:09:41 -0400
Date: 2011-10-01T07:09:41-04:00	[thread overview]
Message-ID: <82sjndx91m.fsf@stephe-leake.org> (raw)
In-Reply-To: j64qhi$f7h$1@speranza.aioe.org

tmoran@acm.org writes:

>> The only place I have found fixed point to be useful is for time;
>> everything else ends up needing to be scaled, so it might as well be
>> floating point from the beginning.
>
>   Also for matching instrument or control values, formatting output,
> saving memory, interfacing to C stuff, or future proofing.
>
> In embedded devices measurements usually come in implicitly scaled
> integers, not float, as do output control values.

Well, yes. I do declare fixed point types that match hardware values.
But they immediately get turned into float (or time fixed point); they
are not used in computations.

> If Degrees is fixed point, Degrees'image is much more readable than
> if it's in floating point.

Put (item, fore, aft, exp) gives the same control.

> Usually real world physical values don't need 32 or more bits of float
> for either their range or precision.  If memory size (or IO time) is
> an issue, they can be stored in much smaller fixed point format.

Yes; these are reasonable criteria.

> Very often values passed to C et al are scaled, eg durations are
> milliseconds or seconds or hundreths of seconds, represented as integers,
> angles are tenths of a degree integers, and so forth.  Trying to do
> calculations remembering the proper scaling is error-prone, but the
> compiler will do it correctly if you use fixed point.

Yes. Luckily, I don't have to do that often at all :). 

-- 
-- Stephe



  parent reply	other threads:[~2011-10-01 11:10 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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   ` 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       ` 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     ` robin
1997-12-03  0:00       ` Robert Dewar
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-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
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   ` 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-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-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