This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: FLOATING-POINT CONSISTENCY, -FFLOAT-STORE, AND X86
- To: "egcs at cygnus dot com" <egcs at cygnus dot com>, "N8TM at aol dot com" <N8TM at aol dot com>, "Toon Moene" <toon at moene dot indiv dot nluug dot nl>
- Subject: Re: FLOATING-POINT CONSISTENCY, -FFLOAT-STORE, AND X86
- From: "Geert Bosch" <bosch at gnat dot com>
- Date: Sun, 20 Dec 1998 00:14:29 +0100
- Reply-To: "Geert Bosch" <bosch at gnat dot com>
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