This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abbeyj
Recipients abbeyj
Date 2009-06-05.05:45:37
SpamBayes Score 0.00010041656
Marked as misclassified No
Message-id <1244180782.5.0.462809934135.issue6198@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2009-06-05 05:46:35abbeyjsetrecipients: + abbeyj
2009-06-05 05:46:22abbeyjsetmessageid: <1244180782.5.0.462809934135.issue6198@psf.upfronthosting.co.za>
2009-06-05 05:46:13abbeyjlinkissue6198 messages
2009-06-05 05:45:54abbeyjcreate