This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients facundobatista, gvanrossum, jyasskin, mark.dickinson, rhettinger
Date 2008-01-10.00:38:34
SpamBayes Score 0.031691335
Marked as misclassified No
Message-id <ca471dc20801091638q20eb6827j6a372d107a8d3c7f@mail.gmail.com>
In-reply-to <1199924957.32.0.750589984318.issue1682@psf.upfronthosting.co.za>
Content
On Jan 9, 2008 4:29 PM, Raymond Hettinger <report@bugs.python.org> wrote:
> I think the history of rational modules is that simplistic
> implementations get built and then the writers find that exploding
> denominators limit their usefulness for anything other than trivial
> problems.  The solution is to limit denominators but that involves less
> trivial algorithms and a more sophisticated API.

A "rational" type that limits denominators (presumably by rounding)
isn't needed -- we alreay have Decimal.  The proposed rational type is
meant for "pure" mathematical uses, just like Python's long ints.

Regarding float->rational, I propose to refuse Rational(1.1) for the
same reasons as Decimal(1.1) is refused, but to add a separate
constructor (a class method?) that converts a float to a rational
exactly (as long as it isn't nan or inf), large denominators be
damned. This can help people who are interested in taking floating
point numbers apart.

float(Rational()) should be fine.
History
Date User Action Args
2008-01-10 00:38:35gvanrossumsetspambayes_score: 0.0316913 -> 0.031691335
recipients: + gvanrossum, rhettinger, facundobatista, mark.dickinson, jyasskin
2008-01-10 00:38:34gvanrossumlinkissue1682 messages
2008-01-10 00:38:34gvanrossumcreate