How about adding rational fraction to Python?

Mark Dickinson dickinsm at gmail.com
Tue Feb 26 21:39:09 EST 2008


On Feb 26, 9:00 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Certainly, I'd expect that if x and y are both integers and x is an
> exact multiple of y, then x/y will be computable and not overflow.
> But try computing 10**5000 / 10**4000 under future division (that is
> supposed to give a float).

And smaller numbers are problematic too:

>>> from __future__ import division
>>> 10**50/10**40
10000000000.0
>>> 10**60/10**50
9999999999.9999981

This despite the fact that the quotient *is* exactly representable
as a float...

Mark



More information about the Python-list mailing list