[issue7201] double Endian problem and more on arm
Mancausoft added the comment: Mark Dickinson scrisse: > The 4th failure (test_endian_double) probably has nothing to do with > ctypes. See also issue #1762561. I try to use the patch arm-float2.diff, but test result is the same: == FAIL: test_struct_return_2H (ctypes.test.test_as_parameter.AsParamPropertyWrapperTestCase) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_as_parameter.py", line 171, in test_struct_return_2H self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) AssertionError: (99, 88) != (198, 264) == FAIL: test_struct_return_2H (ctypes.test.test_as_parameter.AsParamWrapperTestCase) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_as_parameter.py", line 171, in test_struct_return_2H self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) AssertionError: (99, 88) != (198, 264) == FAIL: test_struct_return_2H (ctypes.test.test_as_parameter.BasicWrapTestCase) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_as_parameter.py", line 171, in test_struct_return_2H self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) AssertionError: (99, 88) != (198, 264) == FAIL: test_endian_double (ctypes.test.test_byteswap.Test) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_byteswap.py", line 137, in test_endian_double self.failUnlessEqual(bin(struct.pack(" <http://bugs.python.org/issue7201> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7201] double Endian problem and more on arm
New submission from Mancausoft : I compile python for arm (on debian etch) but it don't pass ctype test: == FAIL: test_struct_return_2H (ctypes.test.test_as_parameter.AsParamPropertyWrapperTestCase) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_as_parameter.py", line 171, in test_struct_return_2H self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) AssertionError: (99, 88) != (198, 264) == FAIL: test_struct_return_2H (ctypes.test.test_as_parameter.AsParamWrapperTestCase) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_as_parameter.py", line 171, in test_struct_return_2H self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) AssertionError: (99, 88) != (198, 264) == FAIL: test_struct_return_2H (ctypes.test.test_as_parameter.BasicWrapTestCase) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_as_parameter.py", line 171, in test_struct_return_2H self.failUnlessEqual((s2h.x, s2h.y), (99*2, 88*3)) AssertionError: (99, 88) != (198, 264) == FAIL: test_endian_double (ctypes.test.test_byteswap.Test) -- Traceback (most recent call last): File "/mnt/root/stackless-2.6.3/Lib/ctypes/test/test_byteswap.py", line 137, in test_endian_double self.failUnlessEqual(bin(struct.pack(" <http://bugs.python.org/issue7201> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1678380] 0.0 and -0.0 identified, with surprising results
Mancausoft added the comment: Mark Dickinson scrisse: > > Mark Dickinson added the comment: > > Here's a patch for floats. Mancausoft, could you give this a try and > let me know whether it fixes the issue? it works. test_math Ran 39 tests in 23.561s OK test_float Ran 19 tests in 275.241s OK Mancausoft -- ___ Python tracker <http://bugs.python.org/issue1678380> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1678380] 0.0 and -0.0 identified, with surprising results
Mancausoft added the comment: Mark Dickinson scrisse: > Mancausoft: is this little-endian, OABI? Mixed endian > If so, then I think I know what the problem is: the disambiguation > code in compile.c looks at the first and last bytes of the double to > distinguish 0.0 and -0.0; for mixed-endian (aka little-endian, > swapped words) doubles this will fail. > > The solution is to use copysign instead. I try: *p==0 && p[sizeof(double)-1]==0 && p[(sizeof(double)-1)/2]==0; and now the test_math result is: Ran 39 tests in 21.323s OK It's a safe patch? Mancausoft -- ___ Python tracker <http://bugs.python.org/issue1678380> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1678380] 0.0 and -0.0 identified, with surprising results
Mancausoft added the comment: This bug is still present on arm. Python 2.6.3 cs-e9302# cat ../prova.py import math print math.atan2(0., -0.) print (math.copysign(4., -0.), -4.0) print math.atan2(0., -0.) print (math.copysign(4., -0.), -4.0) print math.atan2(0., -0.) cs-e9302# cat ../prova1.py import math print (math.copysign(4., -0.), -4.0) print math.atan2(0., -0.) print (math.copysign(4., -0.), -4.0) print math.atan2(0., -0.) cs-e9302# ./python ../prova1.py (-4.0, -4.0) -3.14159265359 (-4.0, -4.0) -3.14159265359 cs-e9302# ./python ../prova.py 0.0 (4.0, -4.0) 0.0 (4.0, -4.0) 0.0 >>> from math import atan2 >>> x = -0. >>> y = 0. >>> print atan2(y, -1.) 3.14159265359 >>> exec("from math import atan2; x = -0.; y = 0.; print atan2(y, -1.)") -3.14159265359 >>> x = -0.; atan2(0., -1) -3.1415926535897931 >>> x = 0.; atan2(0., -1) 3.1415926535897931 == FAIL: testAtan2 (__main__.MathTests) -- Traceback (most recent call last): File "Lib/test/test_math.py", line 131, in testAtan2 self.ftest('atan2(0., -0.)', math.atan2(0., -0.), math.pi) File "Lib/test/test_math.py", line 57, in ftest (name, value, expected)) AssertionError: atan2(0., -0.) returned 0.0, expected 3.1415926535897931 == FAIL: testCopysign (__main__.MathTests) -- Traceback (most recent call last): File "Lib/test/test_math.py", line 806, in testCopysign self.assertEqual(math.copysign(4., -0.), -4.0) AssertionError: 4.0 != -4.0 -- -- nosy: +mancausoft ___ Python tracker <http://bugs.python.org/issue1678380> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com