divmod with negative Decimal values

Rob Cliffe rob.cliffe at btinternet.com
Fri Aug 18 05:14:18 EDT 2023


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('-1'))

Best wishes
Rob Cliffe


More information about the Python-list mailing list