hash policy patch
Robert Dewar
dewar@adacore.com
Sat Sep 17 13:41:00 GMT 2011
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
More information about the Libstdc++
mailing list