This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: hash policy patch


On 9/17/2011 5:38 AM, Paolo Carlini wrote:
On 09/17/2011 11:27 AM, François Dumont wrote:
Paolo, I know that using float equality comparison is not reliable in
general and I have remove the suspicious line but in this case I can't
imagine a system where it could fail.
As a general policy, in the testsuite we should never assert equality of
floating point quantities, sooner or later that would byte us, and very
badly (just search our Bugzilla or the web if you are not convinced).
And, given that, I don't think we should waste time figuring out whether
in specific cases, for specific machines, actually it would be safe to
do it.

An absolute rule of this kind makes me a bit nervous. There are perfectly legitimate algorithms that assume IEEE arithmetic and expect and should get absolute equality, and as long as the test is restricted to IEEE, it seems quite reasonable to have equality checks.

If you are creating a set of records where a unique floating-point
value is the key, that's another case where equality comparison
is reasonable.

Finally

if x = x

is a reasonable test for not being a NaN


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