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 4.0.1 (Apple Inc. build 5493)] on darwin Type "credits", "demo" or "enthought" for more information. >>> from decimal import * >>> a = Decimal("-3.86") >>> a.quantize(Decimal(".1"), ROUND_CEILING) Decimal('-3.8') >>> a.quantize(Decimal(".1"), ROUND_FLOOR) Decimal('-3.9') Closing as invalid. ---------- resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17072> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com