what's the precision of fractions.Fraction?
dickinsm at gmail.com
Sat Nov 20 10:46:33 CET 2010
On Nov 19, 3:29 pm, RJB <rbott... at 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
Or perhaps just use the existing Fraction.limit_denominator method
(which does indeed use some number theory and continued fractions):
>>> from fractions import Fraction
>>> from math import pi
More information about the Python-list