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: Serious bug



kamil@dwd.interkom.pl said:
> Not to me. I was taught NEVER to use == or != with floating point,
> because they simply don't make sense. Too bad that C[++] standard
> allows them. 

Actually, in ieee754 == and != have one very important use: they can be 
used to test for a NaN without causing a fault.
	double a;
	...
	if (a != a)
	{ 
	  /* Code to deal with a NaN */
	}

Comparing different floating point numbers for (in)equality is definitely 
a no-no.

Richard



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