3.2*2 is 9.6 ... or maybe it isn't?
steve at REMOVE-THIS-cybersource.com.au
Fri Jun 26 12:01:52 CEST 2009
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
>>>> print a * 3
Not so. Decimal suffers from the exact same problem, just with different
>>> import decimal
>>> x = decimal.Decimal('1')/decimal.Decimal('3')
>>> 3*x == 1
Some numbers can't be represented exactly in base 2, and some numbers
can't be represented exactly in base 10.
More information about the Python-list