[Edu-sig] Long Integer Fractions
Kirby Urner
pdx4d@teleport.com
Wed, 17 May 2000 13:16:37 -0700
At 10:21 PM 05/17/2000 +0200, Marc Keller wrote:
>Kirby Urner wrote:
>
>> On Fri, 12 May 2000 23:58:05 -0700 I wrote:
>> >Anyway, I wrote a Fraction class that sort of does
>> >this (computes with fractions) -- maybe I'm reinventing
>> >a wheel or two....
>
>Just to mention two such modules : surd.py (1995) and yarn.py (1996)
>found at Vaults of Parnassus
> http://www.vex.net/parnassus/
>in the Maths resources.
Yep, I was reinventing a wheel. Not surprised.
yarn.py looks good. gcd() is especially fine:
def gcd(a, b):
"""Return GCD of two numbers. Duh!
"""
while b:
a, b = b, a % b
return a
(That's Lanny's duh, not mine).
Kirby