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

Mark Hahn mark at prothon.org
Wed Aug 11 20:53:21 CEST 2004


Michael Chermside wrote:

>Mark Hahn writes:
>> I am more interested now in hearing about people's feelings on the
>> idea of having the Decimal type "in-between" Int and Float.  
>Assume a
>> decent Decimal implementation is used.
>
>All right. I think that "in-between" Int and Float is a bad
>idea -- or at least that it's a bad way to think about a decent design.
>
>"in-between" suggests that Float has greater range than
>Decimal which has greater range than Int... but in your design 
>that simply isn't true. Your Int, for instance, can represent 
>values that neither Decimal nor Float can handle.

What do you think of the newer idea of using the IBM floating decimal for
all numerics?  Tim Peters and others pushed this on me.  

Performance would be handled somewhat by automatically switching between
ints, bigints,  and decimal internally, but with no loss of precision
except when a divide or other such operation happens.  I would still have a
hardware based binary floating point type that you have to manually specify
if you want hardware performance for floats.

I am thinking of having all current constant formats default to the
"Decimal" type (0, 123, 123.456, 123e3) and have a new constant type using
the letter 'f' for the binary "Float" type (0f0, 123f0, 123.456f0, 123.f3).



More information about the Python-Dev mailing list