Re: CDC Floating point = tests?
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Tue, 30 Jan 2007 10:29:01 -0800
stocksami@xxxxxxxxxxxxx wrote:
On the old CDC machines running EKS you could use a regular if test to see if two floating point values were equal, and it worked! I've ported lots of code from EKS to other platforms and I've had to change those lines of codes many many times.
Two equal normalized floating point values should compare equal
as fixed point, assuming that all bits go into both comparisons.
(Note, for example, that on the 704 only 16 bits of a 36 bit word
are used for fixed point. I don't know if all 36 are compared.)
Some machines stored floating point values unnormalized, such
that integer values stored as floating point would compare
equal to the same integer stored in fixed point.
Also, there are machines that are designed to compare fixed and
float with the same instructions. The PDP-10 stores negative
floating point by twos complementing the whole word, such that
greater than, equal to, and less than can all be done with fixed
point compare. (The only one that is supplied.)
> I'm currently doing another
upgrade to one of those programs. It would read in floating point values with formatted read statements and compare to other floating point values. They weren't integer values either. The code relied heavily on this and it worked fine. How did this work? How did the CDC compiler handle this?
In general, it is recommended not to do equality tests on floating point. Among others, the compiler and run time library don't always
use the same conversion routines. Also, constant expressions evaluated
at compile time may be different than expressions evaluated at run time.
(Even without the problems of excess precision.)
-- glen
.
- References:
- CDC Floating point = tests?
- From: stocksami@xxxxxxxxxxxxx
- CDC Floating point = tests?
- Prev by Date: Re: F77 -> F95 Intro Presentation Material
- Next by Date: Re: F77 -> F95 Intro Presentation Material
- Previous by thread: Re: CDC Floating point = tests?
- Next by thread: Re: CDC Floating point = tests?
- Index(es):
Relevant Pages
|