[Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues

Steve Holden sholden@holdenweb.com
Thu, 3 Oct 2002 08:52:01 -0400


Christian Tismer <tismer@tismer.com> wrote ...
> Andrew Koenig wrote:
[rational representations]

> > Seriously, I don't know whether it would help in practice.
> > It might be that normalizing rationals from time to time would
> > be enough.
>
> Ok, not just zeros, but normalizing the fraction to no
> common denominator. That makes sense if lots of small
> numbers/fractions were multiplied and prime factors
> pile up.
> Not so with addition. This creates completely different
> prime factors all the time, and addition becomes much
> more expensive than multiplication when the common
> denominator must always be reduced to the minimum.
>
> gotta-be-expensive  -- chris
>
Next someone will suggest that we store rationals as a sequence of
coefficients of the prime factors. This would make primes really easy to
recognise (since they'd be a sequence of zeros followed by a one with a
single one as denominator).

but-it-might-slow-down-other-operations-a-bit-ly y'rs  - steve
-----------------------------------------------------------------------
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Previous .sig file retired to                    www.homeforoldsigs.com
-----------------------------------------------------------------------