From be1be0d1fe72bf55228895a5fd4b3ff34aadcdc2 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 12 Apr 2005 20:23:09 +0000 Subject: [PATCH] Deal with NaN & infinity in the hash float function on Broland. [SVN r28186] --- include/boost/functional/hash/hash.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index b127623..e0e1b42 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -220,6 +220,15 @@ namespace boost template inline std::size_t float_hash_value(T v) { +#if defined(__BORLAND__) + if(v == std::numeric_limits::quiet_NaN()) + return 0; + if(v == std::numeric_limits::infinity()) + return 1; + if(v == -std::numeric_limits::infinity()) + return 2; +#endif + int exp; v = boost::hash_detail::call_frexp(v, &exp);