Это ограничение с плавающей запятой; обойти это с помощью decimal.Decimal
.
>>> from decimal import Decimal
>>> Decimal(-34.11/2) # See? Not quite the value you thought.
Decimal('-17.05499999999999971578290569595992565155029296875')
>>> Decimal(-34.11) / Decimal(2) # This doesn't quite work either, because -34.11 is already a little bit off.
Decimal('-17.05499999999999971578290570')
>>> Decimal("-34.11") / Decimal("2")
Decimal('-17.055')
>>> round(Decimal("-34.11") / Decimal("2"), 2)
Decimal('-17.06')