How about adding rational fraction to Python?

Carl Banks pavlovevidence at gmail.com
Sat Feb 16 16:25:56 EST 2008


On Feb 16, 3:03 pm, Lie <Lie.1... at gmail.com> wrote:
> Although rationals have its limitations too, it is a much
> better choice compared to floats/Decimals for most cases.

Maybe that's true for your use cases, but it's not true for most cases
in general.

Rationals are pretty useless for almost any extended calculations,
since the denominator tends to grow in size till it's practically
unusbale, which means you have to periodically do non-exact reductions
to keep things running, and if you do that you might as well be using
floating point.

Rationals have their occasional special purpose uses, but for most
cases they're at best marginally better then floats and more often
incomparably worse.


Carl Banks



More information about the Python-list mailing list