This is the mail archive of the
mailing list for the libstdc++ project.
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
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
If you are creating a set of records where a unique floating-point
value is the key, that's another case where equality comparison
if x = x
is a reasonable test for not being a NaN