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 Kotan
Recipients Kotan
Date 2011-05-05.08:35:18
SpamBayes Score 3.1658437e-10
Marked as misclassified No
Message-id <1304584519.64.0.99823949629.issue12005@psf.upfronthosting.co.za>
In-reply-to
Content
I know that the modulo operation for negative values is not well defined, but I would at least expect that the result is the same no matter if you use ints, floats or decimals. However Decimal seem to behave else than the builtin types.

Python 3.1.2 (release31-maint, Sep 17 2010, 20:27:33) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> -3 % 5
2
>>> -3. % 5.
2.0
>>> Decimal(-3) % Decimal (5)
Decimal('-3')
>>> 

I could reproduce the same for python 2.6.6.
History
Date User Action Args
2011-05-05 08:35:19Kotansetrecipients: + Kotan
2011-05-05 08:35:19Kotansetmessageid: <1304584519.64.0.99823949629.issue12005@psf.upfronthosting.co.za>
2011-05-05 08:35:18Kotanlinkissue12005 messages
2011-05-05 08:35:18Kotancreate