Zentrader wrote:

> You can use Python's decimal class if floating point arithmetic is not
> exact enough

This is a misleading statement. While it's true that decimal can be more
precise in the sense that smaller fractions are representable, the
underlying problem of certain values not being representable properly &
leading to rounding errors still exists:



>>> import decimal
>>> d = decimal.Decimal
>>> d("1") / d("3")
Decimal("0.3333333333333333333333333333")
>>> otrd = d("1") / d("3")
>>> otrd * 3
Decimal("0.9999999999999999999999999999")
>>> otrd * d("3")
Decimal("0.9999999999999999999999999999")
>>>


Diez
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to