This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FLOATING-POINT CONSISTENCY, -FFLOAT-STORE, AND X86


On Sat, 19 Dec 1998 21:37:49 +0100, Toon Moene wrote:

  In the mean time, it would be useful for the compiler to warn about
  testing floating point variables for (in)equality.

Testing for equality is perfectly fine on systems with IEEE arithmetic 
and many algorithms would be impossible to write efficiently if one would 
regard floating-point as a fuzzy kind of real value. Your statement would 
be true in the pre-IEEE era, but fortunately fpt arithmetic is well-defined 
on the large majority of current systems.

If you want to know why, I advise you to read "What Every Computer Scientist 
Should Know About Floating-Point Arithmetic", by David Goldberg, in ACM 
Computing Surveys, vol. 23 nr. 1, march 1991, available in PostScript at:
http://swift.lanl.gov/Internal/Computing/SunOS_Compilers/common-tools/numerical_comp_guide/goldberg1.ps

Regards,
   Geert




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]