[Boost-bugs] [Boost C++ Libraries] #4038: hash_value(float) collision

Subject: [Boost-bugs] [Boost C++ Libraries] #4038: hash_value(float) collision
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-24 00:49:21


#4038: hash_value(float) collision
----------------------------------------+-----------------------------------
 Reporter: dsharlet@… | Owner: danieljames
     Type: Bugs | Status: new
Milestone: Boost 1.43.0 | Component: hash
  Version: Boost 1.41.0 | Severity: Problem
 Keywords: hash_value collision float |
----------------------------------------+-----------------------------------
 the hash_value function for floats has at least one collision that is
 rather serious:

 std::size_t zero = boost::hash_value(0.0f);
 std::size_t half = boost::hash_value(0.5f);

 both of these have the same hash value. Why not just use reinterpret_cast
 <> for this hash function?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4038>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC