From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,486bed9a72d373b X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Floating point problems in GNAT Date: 1997/02/19 Message-ID: #1/1 X-Deja-AN: 219865300 References: <5dt3n1$jnf@taiwan.informatik.uni-rostock.de> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1997-02-19T00:00:00+00:00 List-Id: In article 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...