Math errors in python
Andrea Griffini
agriff at tin.it
Mon Sep 20 01:56:08 EDT 2004
On 19 Sep 2004 15:24:31 -0700, danb_83 at yahoo.com (Dan Bishop) wrote:
>Also, the
>IEEE 754 double-precision representation of pi is equal to the
>rational number 4503599627370496/281474976710656.
I know the real uses of a precise pi are not that many... but
isn't that a quite raw approximation ? that fraction equals 16...
>Base 10 _is_ more accurate for monetary amounts, and for this reason I
>agreed with the addition of a decimal class. But it would be a
>mistake to use decimal arithmetic, which has a performance
>disadvantage with no accuracy advantage, in the general case.
For monetary computation why not using fixed point instead
(i.e. integers representing the number of thousands of cents,
for example) ? IMO using floating point instead of something
like arbitrary precision integers is looking for trouble in
that area as often what is required is accuracy up to a
specified fraction of the unit.
Andrea
PS: From a study seems that 75.7% of people tends to believe
more in messages that contain precise numbers (like 75.7%).
More information about the Python-list
mailing list