Commit bea9840e by Paolo Carlini Committed by Paolo Carlini

hash-long-double-aux.cc (hash<long double>:: operator()(long double)): Hash both -0 and +0 to 0.

2010-02-28  Paolo Carlini  <paolo.carlini@oracle.com>

       * src/hash-long-double-aux.cc (hash<long double>::
       operator()(long double)): Hash both -0 and +0 to 0.

From-SVN: r157120
parent 91ad7e13
2010-02-28 Paolo Carlini <paolo.carlini@oracle.com>
* src/hash-long-double-aux.cc (hash<long double>::
operator()(long double)): Hash both -0 and +0 to 0.
2010-02-25 Ed Smith-Rowland <3dw4rd@verizon.net>
* include/bits/random.tcc (operator<<): Use max_digits10.
......
......@@ -28,7 +28,9 @@
size_t
hash<long double>::operator()(long double __val) const
{
size_t __result = 0;
// 0 and -0 both hash to zero.
if (__val == 0.0L)
return 0;
int __exponent;
__val = __builtin_frexpl(__val, &__exponent);
......@@ -44,7 +46,5 @@
const size_t __coeff = __SIZE_MAX__ / __LDBL_MAX_EXP__;
__result = __hibits + (size_t)__val + __coeff * __exponent;
return __result;
return __hibits + (size_t)__val + __coeff * __exponent;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment