hash_append icon indicating copy to clipboard operation
hash_append copied to clipboard

Floating point numbers.

Open antialize opened this issue 10 years ago • 1 comments

When hashing floats. You seem to handle plus and minus zero as the same value (as you should). In floats there are many different NAN values, that generally fall into thee classes, -infinity, +infinity and "the rest". Do you not agree that all floats in the "the rest" class should hash to the same value? In boost they switch over the result of std::fpclassify when hashing floats.

antialize avatar Oct 30 '14 15:10 antialize

infinity and -infinity compare not equal and have different bit patterns, and thus different hash codes. All is well there.

Nans are a different story. nan != nan, irregardless of the bit pattern representing the nan. This is sufficiently troublesome that nans today don't go into any associative or unordered container using the default comparators. To date, this proposal has done nothing to change that: nans are still not supported by default.

HowardHinnant avatar Oct 30 '14 16:10 HowardHinnant