[issue17072] Decimal, quantize, round and negative value

2013-02-10 Thread Hakim Taklanti
Hakim Taklanti added the comment: You is right. I had just see the beginning of documentation ("Rounding options include..."). Sorry for the bother and thanks for the answer. -- ___ Python tracker

[issue17072] Decimal, quantize, round and negative value

2013-02-10 Thread Mark Dickinson
Mark Dickinson added the comment: It's not obvious to me how the documentation could be made clearer: all the rounding modes are described at http://docs.python.org/2/library/decimal.html#decimal.Context for the Python 2 docs, and in a separate section entitled 'Rounding modes' for the Pytho

[issue17072] Decimal, quantize, round and negative value

2013-01-29 Thread Hakim Taklanti
Hakim Taklanti added the comment: Indeed, perhaps to enhance the documentation. Thanks. -- ___ Python tracker ___ ___ Python-bugs-list

[issue17072] Decimal, quantize, round and negative value

2013-01-29 Thread Mark Dickinson
Mark Dickinson added the comment: Sorry, I take that back. The behaviour is correct: ROUND_UP rounds away from zero; ROUND_DOWN towards zero. For rounding towards +/- infinity, you want ROUND_CEILING and ROUND_FLOOR: Python 2.7.3 |EPD 7.3-1 (32-bit)| (default, Apr 12 2012, 11:28:34) [GCC

[issue17072] Decimal, quantize, round and negative value

2013-01-29 Thread Mark Dickinson
Mark Dickinson added the comment: Indeed, that looks wrong. I'll take a look. -- assignee: -> mark.dickinson nosy: +mark.dickinson ___ Python tracker ___ __

[issue17072] Decimal, quantize, round and negative value

2013-01-29 Thread Hakim Taklanti
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(