On 8/18/2023 5:14 AM, Rob Cliffe via Python-list wrote:
divmod(Decimal("-1"), 60)
It's not divmod per se, but the modulus operation:
from decimal import Decimal
D1 = Decimal(-1)
D1 % 60 # Decimal(-1)
fmod() performs the same way:
from math import fmod
fmod(-1, 60) # -1.0
From the Python d
I am using Python 3.11.4.
Can anyone explain why Decimal values behave differently from ints when
negative values are used in divmod as follows:
>>> divmod(-1, 60)
(-1, 59) # as expected
>>> divmod(Decimal("-1"), 60)
(Decimal('-0'), Decimal('