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

Tim Peters tim.one@comcast.net
Thu, 03 Oct 2002 00:00:51 -0400


[Andrew Koenig]
> ...
> Seriously, I don't know whether it would help in practice.
> It might be that normalizing rationals from time to time would
> be enough.

Do check out Val=E9rie M=E9nissier-Morain's work on exact rational ar=
ithmetic in
Caml; I've referenced it several times before, and this discussion is=
 always
the same <wink>.  In real apps, the time it takes to normalize ration=
als can
be a disaster (the gcd of two random ints is most likely to be 1, and
longint gcds are very expensive).  In other real apps, not normalizin=
g
rationals can be a disaster.  There isn't a one-size-fits-all policy =
for
this, and a serious implementation has to take that seriously (sorry,=
 Scheme
<wink>).