This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients Hakim.Taklanti, mark.dickinson
Date 2013-01-29.16:18:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359476318.48.0.167982889405.issue17072@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-01-29 16:18:38mark.dickinsonsetrecipients: + mark.dickinson, Hakim.Taklanti
2013-01-29 16:18:38mark.dickinsonsetmessageid: <1359476318.48.0.167982889405.issue17072@psf.upfronthosting.co.za>
2013-01-29 16:18:38mark.dickinsonlinkissue17072 messages
2013-01-29 16:18:38mark.dickinsoncreate