This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients loewis, mark.dickinson, serhiy.storchaka, skrah, tom.pohl
Date 2012-11-12.14:25:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352730312.79.0.973937651072.issue16460@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2012-11-12 14:25:12skrahsetrecipients: + skrah, loewis, mark.dickinson, serhiy.storchaka, tom.pohl
2012-11-12 14:25:12skrahsetmessageid: <1352730312.79.0.973937651072.issue16460@psf.upfronthosting.co.za>
2012-11-12 14:25:12skrahlinkissue16460 messages
2012-11-12 14:25:12skrahcreate