On Thu, 25 Jun 2009 12:41:13 -0600, Michael Torrie wrote:
> If you want accurate math, check out other types like what is in the
> decimal module:
>
>>>> import decimal
>>>> a=decimal.Decimal('3.2')
>>>> print a * 3
> 9.6
Not so. Decimal suffers from the exact same problem, just with different
numbers:
>>> import decimal
>>> x = decimal.Decimal('1')/decimal.Decimal('3')
>>> 3*x == 1
False
Some numbers can't be represented exactly in base 2, and some numbers
can't be represented exactly in base 10.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list