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

Tim Peters tim.one@comcast.net
Thu, 03 Oct 2002 14:55:46 -0400


[Skip Montanaro]
> ...
> Is there a middle ground where you can say, in effect, "give me rational
> numbers which are truncated to provide precision no worse than N-bit
> floating point numbers"?

Yes, so-called "fixed slash" and "floating slash" arithmetics do exactly
that.  BTW, they tend to give exactly the right results despite intermediate
roundoff errors when the *problem* domain is such that the correct results
are simple fractions.

But this is just another thing that gets mentioned every time this
discussion resurrects, so that's all I'm going to say about it this time
around.  There are literally hundreds of schemes for computer arithmetics
that have been tried and found genuinely useful for *some* things.  The only
ones on the table with any claim to broad usefulness are rationals and
decimal fp.