Stefan Krah added the comment: Any programming language that uses binary floats behaves like that and it is actually what people expect.
If you want behavior that is closer to pencil and paper calculations, you need to use decimal: >>> Decimal(1) // Decimal("0.1") Decimal('10') Contrast with: >>> Decimal(1) // Decimal(0.1) Decimal('9') The reason: >>> Decimal("0.1") Decimal('0.1') >>> Decimal(0.1) Decimal('0.1000000000000000055511151231257827021181583404541015625') ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16460> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com