[Python-Dev] Re: Re: Decimal type question [Prothon]

Andrew P. Lentvorski, Jr. bsder at mail.allcaps.org
Mon Aug 9 21:46:41 CEST 2004


On Aug 9, 2004, at 11:45 AM, Mark Hahn wrote:

> On Mon, 9 Aug 2004 14:20:15 -0400, Tim Peters wrote:
>>
>> It depends on your goals for Prothon, and also on the relative
>> performance of the various numeric implementations.  Semantically, it
>> would be nicest if Python used the IBM decimal type for everything by
>> default (whether spelled 123, 123.0, or 123e0).
>
> Are you sure you mean that?  I have been assuming that there is a
> fundamental need for an integer type that has no fraction.

Sure, but both binary floating point and Decimal happily inhabit
that space.  The issue in Days Gone By(tm) was the fact that
a single precision float tended to be the default type and
only had about 24 bits of precision (somewhere around 8-9
decimal digits).  Consequently, people would often get surprised
when accumulating small integers ceased to work around 10^8 or 10^9.

With binary FP doubles, this is less of an issue as it has about 54 bits
of precision (about 18 decimal digits or so).  However, it still places
an artificial restriction on maximum precision.

Besides, the only reason programmers write loops as integers is
because accumulating floats "doesn't work".  With Decimal, that
is no longer the case.

-a



More information about the Python-Dev mailing list