mirror of
https://github.com/python/cpython.git
synced 2025-09-15 05:06:12 +00:00
Use a more robust infinity check in _Py_HashDouble.
This fixes a test_decimal failure on FreeBSD 8.0. (modf apparently doesn't follow C99 Annex F on FreeBSD.)
This commit is contained in:
parent
0c08009708
commit
5e0c2748fb
2 changed files with 12 additions and 3 deletions
|
@ -948,6 +948,15 @@ class InfNanTest(unittest.TestCase):
|
|||
self.assertFalse(NAN.is_inf())
|
||||
self.assertFalse((0.).is_inf())
|
||||
|
||||
def test_hash_inf(self):
|
||||
# the actual values here should be regarded as an
|
||||
# implementation detail, but they need to be
|
||||
# identical to those used in the Decimal module.
|
||||
self.assertEqual(hash(float('inf')), 314159)
|
||||
self.assertEqual(hash(float('-inf')), -271828)
|
||||
self.assertEqual(hash(float('nan')), 0)
|
||||
|
||||
|
||||
fromHex = float.fromhex
|
||||
toHex = float.hex
|
||||
class HexFloatTestCase(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue