Message175445
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') |
|
Date |
User |
Action |
Args |
2012-11-12 14:25:12 | skrah | set | recipients:
+ skrah, loewis, mark.dickinson, serhiy.storchaka, tom.pohl |
2012-11-12 14:25:12 | skrah | set | messageid: <1352730312.79.0.973937651072.issue16460@psf.upfronthosting.co.za> |
2012-11-12 14:25:12 | skrah | link | issue16460 messages |
2012-11-12 14:25:12 | skrah | create | |
|