comp.lang.ada
 help / color / mirror / Atom feed
From: l107353@cliffy.lfwc.lockheed.com (Garlington KE)
Subject: Re: Fixed-point question
Date: 1995/04/07
Date: 1995-04-07T00:00:00+00:00	[thread overview]
Message-ID: <3m43ot$grt@butch.lmsc.lockheed.com> (raw)
In-Reply-To: dewar.797192058@gnat

Robert Dewar (dewar@cs.nyu.edu) wrote:
: On most modern machines floating-point is much faster than fixed-point in
: any case. Was there really a good case for using fixed-point in this cas.

I don't know for sure, but I would assume space was the driver (16-bit
fixed-point vs. 32-bit fixed-point). Some of our users like to use fixed
point in large lookup tables to save space.

I've received a couple of replies concerning a "roughly equal" function,
and I think everyone so far ran up against the same snags I did. I haven't
had time to do any more work on this, but if I do, I'll post the results in
case anyone's interested.

To repeat the problem: A user declared a fixed-point type, like

   type D is delta 0.1 range ...

This generates a set of model numbers M. In this particular user's mind,
however, he is thinking in terms of the set S = { ... 2.0, 2.1, 2.2 ... }
(is there a name in Ada for this set?).

What happened was that he did a calculation that yielded the model number
2.25, which is neither the model number used by the compiler for the literal
2.2 nor the model number for the literal 2.3. What the user wants is a way
to map items in M to S, such that the model number for "2.1" will be
equal to 2.1, and both 2.25 and the model number for "2.3" will be equal to
"2.3". This "roughly equal" function would, ideally, be insensitve to the
order of the operands.

If all else fails, I could ask Tartan: their AdaScope debugger does this
mapping, such that when X = 2.25, asking the debugger to print out X yields
the value "2.3". (This also helped to confuse the user; his code was
operating as if X /= 2.3, but the debugger told him X was 2.3!)

--------------------------------------------------------------------
Ken Garlington                  GarlingtonKE@lfwc.lockheed.com
F-22 Computer Resources         Lockheed Fort Worth Co.

If LFWC or the F-22 program has any opinions, they aren't telling me.




  reply	other threads:[~1995-04-07  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-04-01  0:00 Fixed-point question Garlington KE
1995-04-06  0:00 ` Robert Dewar
1995-04-07  0:00   ` Garlington KE [this message]
1995-04-07  0:00     ` Robert Dewar
1995-04-07  0:00   ` Robert I. Eachus
1995-04-07  0:00     ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2015-06-26 13:20 Patrick Noffke
2015-06-26 16:56 ` Jeffrey R. Carter
2015-06-26 18:21   ` Patrick Noffke
2015-06-26 20:21     ` Anh Vo
2015-06-26 20:25     ` Jeffrey R. Carter
2015-06-27  2:55       ` Patrick Noffke
2015-06-26 23:14     ` Qun-Ying
2015-06-27  3:00       ` Patrick Noffke
2015-06-27  4:44         ` Jeffrey R. Carter
2015-06-27 17:59           ` Patrick Noffke
2015-06-27 18:38             ` Jeffrey R. Carter
2015-06-27 19:20               ` Bob Duff
2015-06-27 19:57                 ` Jeffrey R. Carter
2015-06-27 20:42                   ` Bob Duff
2015-06-28 11:39                     ` Brian Drummond
2015-06-29 13:28                     ` Patrick Noffke
2015-06-29 14:13                       ` Bob Duff
2015-06-27 23:41               ` Anh Vo
replies disabled

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