[New-bugs-announce] [issue20342] Float rounding issues on Red Hat 6.4 / PPC64 / GCC 4.4.6
Yury V. Zaytsev
report at bugs.python.org
Wed Jan 22 09:44:31 CET 2014
New submission from Yury V. Zaytsev:
Hi,
I've managed to get the test suite of Python to run on Python 3.4.0b2 version cross-compiled for a specialized POWER chip. I get a number of failures that seem to have the same nature. I'm under impression, that actually the tests might need to be adjusted, but I'm not sure about it. I'm happy to provide any additional information to diagnose this issue. Please let me know if I've grouped them wrong and have to file a different issue for some tests. Thanks!
== CPython 3.4.0b2 (default, Jan 7 2014, 10:01:53) [GCC 4.4.6]
== Linux-2.6.32-358.11.1.bgq.el6.bgas_20131217.ppc64-ppc64-with-redhat-6.4-Santiago big-endian
== hash algorithm: fnv 64bit
== /tmp/test_python_11312
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
======================================================================
FAIL: fromhex (builtins.float)
Doctest: builtins.float.fromhex
----------------------------------------------------------------------
Traceback (most recent call last):
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/doctest.py", line 2187, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for builtins.float.fromhex
File "builtins", line unknown line number, in fromhex
----------------------------------------------------------------------
File "builtins", line ?, in builtins.float.fromhex
Failed example:
float.fromhex('-0x1p-1074')
Expected:
-5e-324
Got:
-4.9406564584124654e-324
----------------------------------------------------------------------
======================================================================
FAIL: test_float__format__ (test.test_types.TypesTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/test/test_types.py", line 467, in test_float__format__
test(1e200, '+', '+1e+200')
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/test/test_types.py", line 403, in test
self.assertEqual(f.__format__(format_spec), result)
AssertionError: '+9.9999999999999997e+199' != '+1e+200'
- +9.9999999999999997e+199
+ +1e+200
----------------------------------------------------------------------
======================================================================
FAIL: SequenceMatcher (difflib)
Doctest: difflib.SequenceMatcher
----------------------------------------------------------------------
Traceback (most recent call last):
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/doctest.py", line 2187, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for difflib.SequenceMatcher
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/difflib.py", line 47, in SequenceMatcher
----------------------------------------------------------------------
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/difflib.py", line 83, in difflib.SequenceMatcher
Failed example:
print(round(s.ratio(), 3))
Expected:
0.866
Got:
0.86599999999999999
----------------------------------------------------------------------
======================================================================
FAIL: test_format_testfile (test.test_float.FormatTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/test/test_float.py", line 592, in test_format_testfile
self.assertEqual(fmt % float(arg), rhs)
AssertionError: '0.029999999999999999' != '0.03'
- 0.029999999999999999
+ 0.03
----------------------------------------------------------------------
======================================================================
FAIL: test_non_ascii (test.test_format.FormatTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/test/test_format.py", line 272, in test_non_ascii
self.assertEqual(format(12.3, "\u2007<6"), "12.3\u2007\u2007")
AssertionError: '12.300000000000001' != '12.3\u2007\u2007'
- 12.300000000000001
+ 12.3\u2007\u2007
----------------------------------------------------------------------
======================================================================
FAIL: test_float_default (test.test_optparse.TestExpandDefaults)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/test/test_optparse.py", line 619, in test_float_default
self.assertHelp(self.parser, expected_help)
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/test/test_optparse.py", line 189, in assertHelp
actual_help + '"\n')
AssertionError: help text failure; expected:
"Usage: test [options]
Options:
-h, --help show this help message and exit
-p PROB, --prob=PROB blow up with probability PROB [default: 0.43]
"; got:
"Usage: test [options]
Options:
-h, --help show this help message and exit
-p PROB, --prob=PROB blow up with probability PROB [default:
0.42999999999999999]
"
----------------------------------------------------------------------
test_doc_tests (test.test_statistics.DocTests) ... **********************************************************************
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/statistics.py", line 290, in statistics.mean
Failed example:
mean([1, 2, 3, 4, 4])
Expected:
2.8
Got:
2.7999999999999998
**********************************************************************
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/statistics.py", line 380, in statistics.median_grouped
Failed example:
median_grouped([1, 2, 2, 3, 4, 4, 4, 4, 4, 5])
Expected:
3.7
Got:
3.7000000000000002
**********************************************************************
File "/XXX/opt/python-3.4.0b2-gcc-cnk/lib/python3.4/statistics.py", line 602, in statistics.pstdev
Failed example:
pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])
Expected:
0.986893273527251
Got:
0.98689327352725098
**********************************************************************
3 items had failures:
1 of 5 in statistics.mean
1 of 4 in statistics.median_grouped
1 of 1 in statistics.pstdev
***Test Failed*** 3 failures.
----------
components: Interpreter Core
messages: 208760
nosy: zaytsev
priority: normal
severity: normal
status: open
title: Float rounding issues on Red Hat 6.4 / PPC64 / GCC 4.4.6
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20342>
_______________________________________
More information about the New-bugs-announce
mailing list