[New-bugs-announce] [issue17072] Decimal, quantize, round and negative value

Hakim Taklanti report at bugs.python.org
Tue Jan 29 17:14:16 CET 2013


New submission from Hakim Taklanti:

>>> from decimal import Decimal
>>> from decimal import ROUND_UP, ROUND_DOWN
>>> a = Decimal("-3.86")
>>> b = Decimal("5.73")
>>> a_up = a.quantize(Decimal(".1"), ROUND_UP)
>>> a.quantize(Decimal(".1"), ROUND_UP) # -3.8 expected
Decimal('-3.9') 
>>> a.quantize(Decimal(".1"), ROUND_DOWN) # -3.9 expected
Decimal('-3.8') 
>>> b.quantize(Decimal(".1"), ROUND_UP) # Ok
Decimal('5.8')
>>> b.quantize(Decimal(".1"), ROUND_DOWN) # Ok
Decimal('5.7')

----------
components: Library (Lib)
messages: 180911
nosy: Hakim.Taklanti
priority: normal
severity: normal
status: open
title: Decimal, quantize, round and negative value
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17072>
_______________________________________


More information about the New-bugs-announce mailing list