[New-bugs-announce] [issue39335] round Decimal edge case

Hrvoje Abraham report at bugs.python.org
Tue Jan 14 16:08:15 EST 2020


New submission from Hrvoje Abraham <ahrvoje at gmail.com>:

>>> from decimal import Decimal
>>> round(Decimal('-123.499999999999999999999999999999999999999999'))
-124.0

I would expect -123.0, even considering Py2 rounding convention details (away from zero), Decimal rounding convention (default rounding=ROUND_HALF_EVEN), floating point specifics...

Works as expected in Py3. Both Py2 and Py3 use same default Decimal rounding=ROUND_HALF_EVEN.

Could be I'm missing some detail...

----------
components: Library (Lib)
messages: 359999
nosy: ahrvoje
priority: normal
severity: normal
status: open
title: round Decimal edge case
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39335>
_______________________________________


More information about the New-bugs-announce mailing list