Message88922
test_float fails on Windows with:
======================================================================
FAIL: test_format_testfile (test.test_float.IEEEFormatTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Projects\python-trunk\lib\test\test_float.py", line 319, in
test_format_testfile
self.assertEqual(fmt % float(arg), rhs)
AssertionError: '3' != '2'
----------------------------------------------------------------------
The problematic line from formatfloat_testcases.txt is:
%.0f 2.5 -> 2
On some systems *printf() uses round-to-even. But the Windows CRT uses
round-half-away-from-zero. Consider the following C code:
printf("%+.1f -> %+.0f\n", -2.5, -2.5);
printf("%+.1f -> %+.0f\n", -1.5, -1.5);
printf("%+.1f -> %+.0f\n", +1.5, +1.5);
printf("%+.1f -> %+.0f\n", +2.5, +2.5);
On Linux this will produce:
-2.5 -> -2
-1.5 -> -2
+1.5 -> +2
+2.5 -> +2
And on Windows:
-2.5 -> -3
-1.5 -> -2
+1.5 -> +2
+2.5 -> +3 |
|
Date |
User |
Action |
Args |
2009-06-05 05:46:35 | abbeyj | set | recipients:
+ abbeyj |
2009-06-05 05:46:22 | abbeyj | set | messageid: <1244180782.5.0.462809934135.issue6198@psf.upfronthosting.co.za> |
2009-06-05 05:46:13 | abbeyj | link | issue6198 messages |
2009-06-05 05:45:54 | abbeyj | create | |
|