This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Serious bug
- To: egcs at cygnus dot com
- Subject: Re: Serious bug
- From: Richard Hadsell <hadsell at blueskystudios dot com>
- Date: Mon, 28 Sep 1998 09:34:21 -0400
- Organization: Blue Sky | VIFX
- References: <199809251655.MAA01021@melange.gnu.org>
This thread began with a sensible complaint, if I recall correctly, and
then got sidetracked by someone falling back on an argument about
rounding problems and the IEEE floating-point standard, etc. The bottom
line for any language ought to be:
(1) If you subtract a number from itself, you get 0.
(2) If you compare a number with itself, you get equality.
(3) If you assign a number to another of the same type, you get the same
number.
This would mean for me, regardless of the C or C++ standard, that
double x = z;
double y = x;
if (y != x)
; // this is an error
if (y - x != 0.)
; // this is an error
This has nothing to do with rounding questions. If the processor
architecture has problems with this, the compiler has to work around
those problems. If this was left out of the C++ standard, it was only
because nobody thought it would be necessary. It's obvious.
If I missed the point of the original complaint, please excuse my
statement of the obvious.
--
Dick Hadsell 914-381-8400 x5446 Fax: 914-381-9790
Reply-to: hadsell@blueskystudios.com
Blue Sky | VIFX http://www.bluesky-vifx.com
1 South Road, Harrison, NY 10528