Hello,
the current implementation function for hashing of floating point types,
the function template float_hash_value<> in hash.hpp, is implicitely
written for real types where std::numeric_limits<T>::radix == 2.
Although base = 2 is probably the most prominent case, it is not the
only representation compatible with Our Holy Standard. E.g. base 16
floating types are well-known to exist.
The hidden assumption becomes obvious in the formular
std::size_t const length
= (std::numeric_limits<T>::digits +
std::numeric_limits<int>::digits - 1)
/ std::numeric_limits<int>::digits;
which should actually mean (pseudo formular):
std::size_t const length
= (std::numeric_limits<T>::digits2 +
std::numeric_limits<int>::digits - 1)
/ std::numeric_limits<int>::digits;
where the (non-existing) constant digits2 would describe the "Number of
base 2 digits that can be represented without change."
To my opinion boost itself provides a simple helper class, namely
static_log2, which allows the correct implementation by using the
extended formular
#include