PEP 327: Decimal Data Type

Mel Wilson mwilson at the-wire.com
Tue Feb 3 17:02:15 CET 2004


In article <bvmh58$4hc$1 at news.service.uci.edu>,
Josiah Carlson <jcarlson at nospam.uci.edu> wrote:
>
>> But if you normalise every time, some theoretically simple operations
>> can become relatively very expensive in terms of time. (Basically,
>> things like addition, which suddenly require a GCD calculation).
>
>If we are to take cues from standard Python numeric types, any
>mathematical calculation results in a new immutable object.  Thusly,
>only normalizing on initialization is sufficient.  Since that is the
>only time you ever get anything new, doing GCD on initialization is the
>minimum and maximum requirement.

   I agree, but that means we do a lot of initializations,
so the performance in doing a computation would be about the
same.

   I tried a decimal floating-point package just lately, for
fun, based on long mantissas and int exponents.  I used this
approach to normalization, because I think it's natural, but
I've been scared to benchmark the package.  I should, I
guess.

        Regards.        Mel.



More information about the Python-list mailing list