Repository URL to install this package:
Version:
7.26.0-0.2 ▾
|
Date: Wed, 3 Feb 88 23:39:04 EST
From: Mike Muuss (SECAD) <mike@XXX.XXX>
This evening I have been working on a program which compares floating
point numbers over the network (part of something much bigger).
I encountered a rather perplexing phenomenon. The Cray-2 and XMP
seem to give very slightly different answers for floating point
divisions. I would have expected them to give the same answers.
For example, the calculation 196.0 / 112.0 gives "1.75" on both
machines, but differing by one bit, i.e.:
XMP 4001E00000000000
Cray-2 4001DFFFFFFFFFFF
^__^
exp
It looks like the XMP is rounding UP, and the Cray-2 is rounding DOWN.
This is easy to check for yourself with this C program:
main() {
double f;
f = 196.0 / 112.0;
printf("f = %g, x%x\n", f, f );
}
Here is the output:
bob> c
f = 1.75, x4001dfffffffffff
patton> c
f = 1.75, x4001e00000000000
ISSUES
*) Is this behavior intrinsic to the "hardware" (reciprocal) divide
units, or is the rounding behavior programmable?
*) For this particular calculation, the LSB behavior is not significant.
However, for some iterative calculations, the LSB behavior may be
significant. It would be useful to understand why the two Crays give
differing results. I can live with a difference, as long as I know
what to expect. However, if the difference can be resolved, that
would be even better.
Best,
-Mike