Source

pypy / pypy / rlib / objectmodel.py

Diff from to

pypy/rlib/objectmodel.py

     x ^= length
     return intmask(x)
 
+HASH_INF  = 314159
+HASH_NAN  = 0
+HASH_IMAG = 1000003
+
 def _hash_float(f):
     """The algorithm behind compute_hash() for a float.
     This implementation is identical to the CPython implementation,
     if not isfinite(f):
         if isinf(f):
             if f < 0.0:
-                return -271828
+                return -HASH_INF
             else:
-                return 314159
+                return HASH_INF
         else: #isnan(f):
-            return 0
+            return HASH_NAN
     v, expo = math.frexp(f)
     v *= TAKE_NEXT
     hipart = int(v)