Using fractions instead of floats
steve at REMOVE-THIS-cybersource.com.au
Fri Oct 5 01:20:15 CEST 2007
On Tue, 02 Oct 2007 06:07:15 +0000, Rhamphoryncus wrote:
> On Sep 30, 7:35 pm, andresj <andres.j.... at gmail.com> wrote:
>> I was doing some programming in Python, and the idea came to my mind:
>> using fractions instead of floats when doing 2/5.
> The core problem with rationals (other than the inability to handle
If that's a problem, it is one shared by ints and floats.
> is their tendency to require more and more memory as
> calculations progress. This means they get mysteriously slower and
I've read that thread, and although I see the claim made that rationals
are slow, I don't see the claim that they get "mysteriously" slower as
calculations progress. (And if they did, it would hardly be a mystery if
we know it is because they use more memory.)
I guess that could occur with unlimited precision rationals, in the same
way that it could occur with ever-larger longints, but I don't see how it
could occur with a simpler, limited precision implementation.
More information about the Python-list