With simple ints:
>>> -45 % 360
315
Whereas with decimal.Decimal:
>>> from decimal import Decimal
>>> Decimal('-45') % 360
Decimal('-45')
I expect to receive Decimal('315').
Is there a reason for this? Is there a way to achieve consistent behavior (without patching decimal.Decimal)? (I did not change the context and cannot find how it could be changed to solve this situation).
source
share