comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Floating point problems in GNAT
Date: 1997/02/19
Date: 1997-02-19T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.97Feb19103524@spectre.mitre.org> (raw)
In-Reply-To: E5KKo6.CKH@thomsoft.com


In article <E5oBMH.6rA@thomsoft.com> kst@aonix.com (Keith Thompson) writes:

  > The division operator yields a result of type universal_fixed; the
  > implicit conversion back to type Duration causes a loss of
  > precision.  As far as the programmer is concerned, this looks like
  > an inexact division operation on type Duration.

   Looks like an implicit conversion to me, and I said that some
conversions are not exact. ;-)  Note that in this problem, the square
root operation in the Distance function by its nature is inexact for
most values, since the exact value is irrational.  However for the
fixed point case, all we care is that Distance return the same result
each time it is called with the same points as arguments.

   But my real (ouch!) point was that the addition and comparison
operations for fixed point types are exact.  In this case, that means
that the order of additions in floating point is significant and will
result in different answers, while in fixed point the order of additions
is immaterial. (We know that all values are positive, so intermediate
overflows are not an issue.)

   I'm probably beating a very dead horse here, but my guess is that
90% of the programmers out there not only don't understand fixed
point, but don't know when the distinction between fixed and floating
point is important.
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




      parent reply	other threads:[~1997-02-19  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-12  0:00 Floating point problems in GNAT Wolfgang Lohmann
     [not found] ` <E5KKo6.CKH@thomsoft.com>
     [not found]   ` <EACHUS.97Feb14115527@spectre.mitre.org>
1997-02-16  0:00     ` Keith Thompson
1997-02-16  0:00       ` Robert Dewar
1997-02-19  0:00   ` Robert I. Eachus [this message]
replies disabled

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