Brett Cannon added the comment:
This is actually expected because that is just how floating point works in
programming (see http://en.wikipedia.org/wiki/Floating_point for all the gnarly
details).
If you want exact decimal arithmetic, use the decimal module (which got
significantly faster in Python 3.3)::
>>> import decimal
>>> decimal.Decimal('.3') - decimal.Decimal('.1')
Decimal('0.2')
>>> decimal.Decimal('.05') + decimal.Decimal('.01')
Decimal('0.06')
----------
nosy: +brett.cannon
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18613>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com