Re: How about adding rational fraction to Python?
Mark Dickinson wrote:
You know what I find weird about this? The result of truncating
division in this case is not just less accurate than it could be; it's
actually greater than the result of non-truncating division.
True
Mark Dickinson wrote:
On Feb 26, 9:00 pm, Paul Rubin <http://phr...@NOSPAM.i nvalidwrote:
>
And smaller numbers are problematic too:
>
10000000000.0
9999999999.9999 981
>
This despite the fact that the quotient *is* exactly representable
>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).
>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
>>>10**50/10**40
>>>10**60/10**50
>
This despite the fact that the quotient *is* exactly representable
division in this case is not just less accurate than it could be; it's
actually greater than the result of non-truncating division.
>>(10**60//10**50) (10**60/10**50)
Comment