Using fractions instead of floats

Rhamphoryncus rhamph at
Tue Oct 2 08:07:15 CEST 2007

On Sep 30, 7:35 pm, andresj <andres.j.... at> 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
irrationals) is their tendency to require more and more memory as
calculations progress.  This means they get mysteriously slower and

My own "pet numeric type" is fixed point.  You get as much precision
as you specify.  Alas, 2/5 would likely result in 0. ;)

Adam Olsen, aka Rhamphoryncus

More information about the Python-list mailing list