[New-bugs-announce] [issue7729] min() working incorrectly for decimal and float values
Umit Oztosun
report at bugs.python.org
Mon Jan 18 09:34:39 CET 2010
New submission from Umit Oztosun <umit.oztosun at gmail.com>:
On MacOSX (10.5) Intel, Python 2.6.4
>>> from decimal import Decimal
>>> min(Decimal('3.0'), 10.2)
10.199999999999999
On Win32, Python 2.6.4
>>> from decimal import Decimal
>>> min(Decimal('3.0'), 10.2)
Decimal('3.0')
On Linux 32 bit, Python 2.6.4
>>> from decimal import Decimal
>>> min(Decimal('3.0'), 10.2)
10.199999999999999
However, the correct result of Win32 version seems completely coincidental, it produces invalid results for other values:
>>> min(Decimal('12.0'), 10.2)
Decimal('12.0')
We are already aware of problems related to float and Decimal comparison, but in this case it complicates matters worse: On Windows code seems to work OK, on other platforms its results are wrong; worse than this, Windows version works totally by coincidence in fact.
It should at least warn user or raise an error IMHO.
----------
components: Library (Lib)
messages: 97991
nosy: Umit.Oztosun
severity: normal
status: open
title: min() working incorrectly for decimal and float values
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7729>
_______________________________________
More information about the New-bugs-announce
mailing list