On Fri, 19 Nov 2010 07:29:59 -0800 (PST), RJB <rbott...@csusb.edu> wrote: > Does Fractions remove common factors the way it should? > > If it does and you want to find the closest fraction with a smaller > denominator i think tou'll need some number theory and continued > fractions.
No heroics required, finding the greatest common divisor is fast. And if this simple test is indicative, the fractions module reduces: >>> x = fractions.Fraction( 2**100, 3 ) >>> y = fractions.Fraction( 7, 2**101 ) >>> z = x * y >>> print x._numerator, x._denominator 1267650600228229401496703205376 3 >>> print y._numerator, y._denominator 7 2535301200456458802993406410752 >>> print z._numerator, z._denominator 7 6 -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list