Re: How about adding rational fraction to Python?
- From: Mensanator <mensanator@xxxxxxx>
- Date: Sun, 24 Feb 2008 15:58:07 -0800 (PST)
On Feb 24, 4:50�pm, Steven D'Aprano <st...@REMOVE-THIS-
cybersource.com.au> wrote:
On Sun, 24 Feb 2008 11:09:32 -0800, Lie wrote:
I decided to keep the num/den limit low (10) because higher values might
obscure the fact that it do have limits.
You do realise that by putting limits on the denominator, you guarantee
that the sum of the fractions also has a limit on the denominator? In
other words, your "test" is useless.
With denominators limited to 1 through 9 inclusive, the sum will have a
denominator of 2*3*5*7 = 210.
Th limit will be 2*2*2*3*3*5*7. As MD said, "equivalently
the product over all primes p <= n of the highest power
of p not exceeding n".
But that limit is a product (literally and
figuratively) of your artificial limit on the denominator. Add a fraction
with denominator 11, and the sum now has a denominator of 2310; add
another fraction n/13 and the sum goes to m/30030; and so on.
--
Steven
.
- References:
- Floating point bug?
- From: robinsiebler
- Re: How about adding rational fraction to Python?
- From: Jeff Schwab
- Re: How about adding rational fraction to Python?
- From: Carl Banks
- Re: How about adding rational fraction to Python?
- From: Jeff Schwab
- Re: How about adding rational fraction to Python?
- From: Carl Banks
- Re: How about adding rational fraction to Python?
- From: Steven D'Aprano
- Re: How about adding rational fraction to Python?
- From: Lie
- Re: How about adding rational fraction to Python?
- From: Carl Banks
- Re: How about adding rational fraction to Python?
- From: Lie
- Re: How about adding rational fraction to Python?
- From: Steve Holden
- Re: How about adding rational fraction to Python?
- From: Lie
- Re: How about adding rational fraction to Python?
- From: Mark Dickinson
- Re: How about adding rational fraction to Python?
- From: Steven D'Aprano
- Floating point bug?
- Prev by Date: Re: packing things back to regular expression
- Next by Date: Re: Article of interest: Python pros/cons for the enterprise
- Previous by thread: Re: How about adding rational fraction to Python?
- Next by thread: Re: How about adding rational fraction to Python?
- Index(es):