comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Effort to Port TSG to Ada-95 and How Fast it Ran in Gnat
Date: 1997/02/21
Date: 1997-02-21T00:00:00+00:00	[thread overview]
Message-ID: <dewar.856573561@merv> (raw)
In-Reply-To: E5xLBK.n13@thomsoft.com


Keith says

<<This is possible according to the Ada language definition, but it
seems unlikely to happen in real life.  Typically, Ada floating-point
comparisons are implemented simply by generating the appropriate hardware
compare instructions.  These instructions don't know anything about
Ada's concept of model numbers, they just operate on the bits.>>

wishful thinking I am afraid. In practice funny things can happen. Consider
the following:

    if a + b > 3.45 then ...

    if a + b = 3.45 then ...

it can easily happen that both of these are true, due to extra temporary
precision in intermediate results. FOr example, consider you are on an
x86 where all registers are 80 bits, and the initial comparison computes
a+b into an 80 bit register and compares it. But the second comaprison
uses a saved value of a+b, which was unfortunately stored in memory in
a 64-bit temporary.

This sort of thing happens in real life all the time on such machines!





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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-19  0:00 Effort to Port TSG to Ada-95 and How Fast it Ran in Gnat Michael F Brenner
1997-02-19  0:00 ` Robert Dewar
1997-02-20  0:00   ` Larry Kilgallen
1997-02-21  0:00     ` Robert Dewar
1997-02-21  0:00   ` Keith Thompson
1997-02-21  0:00     ` Robert Dewar [this message]
1997-02-20  0:00 ` Robert Dewar
1997-02-27  0:00   ` Mats Weber
1997-03-01  0:00     ` Robert Dewar
1997-03-03  0:00       ` Elaboration order (was: Effort to Port TSG to Ada-95 and How Fast it Ran in Gnat) Mats Weber
replies disabled

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