diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-12-04 12:38:19 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-12-04 12:38:19 (GMT) |
commit | 11e77ffcbc4a46001ba6c509f069692b4c5d0735 (patch) | |
tree | 186d7e0f85fc5da018507fe0a1cf6bb9b7b891ec /Lib/test/test_float.py | |
parent | 539928160063dc867458cd4170416aa9b4673c15 (diff) | |
download | cpython-11e77ffcbc4a46001ba6c509f069692b4c5d0735.zip cpython-11e77ffcbc4a46001ba6c509f069692b4c5d0735.tar.gz cpython-11e77ffcbc4a46001ba6c509f069692b4c5d0735.tar.bz2 |
Merged revisions 87032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r87032 | mark.dickinson | 2010-12-04 12:25:30 +0000 (Sat, 04 Dec 2010) | 3 lines
Issue #10596: Fix float.__mod__ to have the same behaviour as
float.__divmod__ with respect to signed zeros.
........
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index fd8436a..6d90637 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -231,6 +231,26 @@ class GeneralFloatCases(unittest.TestCase): self.assertTrue(d == d, "{%r : None} not equal to itself" % f) + @requires_IEEE_754 + def test_float_mod(self): + # Check behaviour of % operator for IEEE 754 special cases. + # In particular, check signs of zeros. + mod = operator.mod + + self.assertEqualAndEqualSign(mod(-1.0, 1.0), 0.0) + self.assertEqualAndEqualSign(mod(-1e-100, 1.0), 1.0) + self.assertEqualAndEqualSign(mod(-0.0, 1.0), 0.0) + self.assertEqualAndEqualSign(mod(0.0, 1.0), 0.0) + self.assertEqualAndEqualSign(mod(1e-100, 1.0), 1e-100) + self.assertEqualAndEqualSign(mod(1.0, 1.0), 0.0) + + self.assertEqualAndEqualSign(mod(-1.0, -1.0), -0.0) + self.assertEqualAndEqualSign(mod(-1e-100, -1.0), -1e-100) + self.assertEqualAndEqualSign(mod(-0.0, -1.0), -0.0) + self.assertEqualAndEqualSign(mod(0.0, -1.0), -0.0) + self.assertEqualAndEqualSign(mod(1e-100, -1.0), -1.0) + self.assertEqualAndEqualSign(mod(1.0, -1.0), -0.0) + class FormatFunctionsTestCase(unittest.TestCase): |