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

Tim Peters tim.one@comcast.net
Wed, 09 Oct 2002 16:34:06 -0400


[Christopher A. Craig]
> I agree.  I initially thought about returning a decimal with str(),
> but for that reason chose not to.

I expect you'll have to in the end, though.  Getting an explicit ratio of
multi-thousand digit integers really does suck for a default ...

> It might be nice to have a method that returned the best floating point
> decimal approximation to within n decimal digits or shorter, but I don't
> want a builtin to make an arbitrary decision on where to cut off
> precision.

If you haven't yet, you should strive to understand Moshe Zadka's prototype
rational implementation in Python CVS nondist/sandbox/ (which has all the
approximation functions you could need).  Unfortunately, the SourceForge
Python Numerics list:

    https://sourceforge.net/mailarchive/forum.php?forum_id=2280

appears to have lost almost all the voluminous discussions that went into
that, retaining mostly a random sampling of spam.