Re: Really basic problem
- From: "Diez B. Roggisch" <deets@xxxxxxxxxxxxx>
- Date: Mon, 08 Oct 2007 18:22:04 +0200
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:
Decimal("0.3333333333333333333333333333")import decimal
d = decimal.Decimal
d("1") / d("3")
Decimal("0.9999999999999999999999999999")otrd = d("1") / d("3")
otrd * 3
Decimal("0.9999999999999999999999999999")otrd * d("3")
Diez
.
- References:
- Really basic problem
- From: tomamil
- Re: Really basic problem
- From: Zentrader
- Really basic problem
- Prev by Date: Adding extra modules to a Pyinstaller build
- Next by Date: [OT] Re: Variable scoping rules in Python?
- Previous by thread: Re: Really basic problem
- Next by thread: Re: Off Topic: Gmail hates newsgroups!!!
- Index(es):
Relevant Pages
|
|