Re: Low-order uncertainty in 87 math processing

David L Moore <>
24 Sep 1997 22:27:29 -0400

          From comp.compilers

Related articles
Low-order uncertainty in 87 math processing (1997-09-24)
Re: Low-order uncertainty in 87 math processing (David L Moore) (1997-09-24)
Re: Low-order uncertainty in 87 math processing (William D Clinger) (1997-09-27)
| List of all articles for this month |

From: David L Moore <>
Newsgroups: comp.compilers,comp.os.msdos.programmer
Date: 24 Sep 1997 22:27:29 -0400
Organization: Netcom
References: 97-09-092
Keywords: arithmetic, comment

Stephen Schumacher wrote:

> x:=y;
> [code not changing x or y]
> q:=x-y;
> [ why is q not zero]

John's suggestions (esp about NAN) are good. As you say it only happens
occasionally, without seeing all the code and knowing the input values,
I would have to rate this the most likely explanation.

Here is another. Unfortunately, you did not give the disassembly, so
I cannot check if this is happening.

If x is getting stored and y is being retained in a floating register,
you lose some precision of x but not y, and the difference in q is the
round-off between the values. (Of course, it might be y that is stored
instead of x, too)

MNF (Minnesota University Fortran) used to print out a warning message
on all attempts to compare floating point numbers for equality.
It went along the lines of "Can this really be expected to compare
and was delivered with a stern wagging of fingers.

David Moore.
[Given that the wierd behavior is repeatable but goes away sometimes until
a reboot, I'd still be looking at those persistent x87 control flags. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.