[New-bugs-announce] [issue1694] floating point number round failures under Linux

Bernhard Mayr report at bugs.python.org
Mon Dec 24 12:53:14 CET 2007


New submission from Bernhard Mayr:

[Bernhard at localhost ~]$ python
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f1=0.55
>>> f2=2.25
>>> print '%.1f, %.1f' % (f1, f2)
0.6, 2.2
>>>
 
f1 is rounded to the next higher value, but f2 is not.


C:\>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f1=0.55
>>> f2=2.25
>>> print '%.1f, %.1f' % (f1, f2)
0.6, 2.3
>>>

Under windows it works properly.


If the floating point numbers are encapsulated behind "round(f, 1)" 
both OS show the same output.

----------
components: Interpreter Core
messages: 58983
nosy: falk_steinhauer
severity: major
status: open
title: floating point number round failures under Linux
type: behavior
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1694>
__________________________________


More information about the New-bugs-announce mailing list