Commit Graph

14 Commits

Author SHA1 Message Date
Mark Dickinson 4af8e745c4 Issue #5812: The two-argument form of the Fraction constructor
now accepts arbitrary Rational instances.
2009-04-24 13:56:07 +00:00
Mark Dickinson 8100bd8431 Issue #5812: make Fraction('1e-6') valid. Backport of r71806. 2009-04-22 18:15:25 +00:00
Raymond Hettinger 933d3a7a54 Issue 4998: __slots__ on Fractions was useless. 2009-01-20 20:34:19 +00:00
Georg Brandl fe427895b5 Manually merge r68095,68186,68187,68188,68190 from 2.6 branch. 2009-01-03 22:03:11 +00:00
Raymond Hettinger b01713e7dc Issue 3285: Fractions from_float() and from_decimal() accept Integral arguments. 2008-07-10 14:34:57 +00:00
Raymond Hettinger 655d583a49 Issue 3287: Raise correct exception for float inputs. 2008-07-10 09:31:08 +00:00
Mark Dickinson 3af386a5cb Remove trailing 'L's from numerator and denominator in the
repr() of a Fraction instance.
2008-06-27 10:11:52 +00:00
Andrew M. Kuchling f484363bae Use repr() for bad input strings; this makes the empty string or binary characters more visible 2008-06-21 13:47:20 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Jeffrey Yasskin 1c214d6c94 Performance optimizations on Fraction's constructor.
./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3)`
31.7 usec/loop -> 9.2 usec/loop

  ./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3, 2)'`
27.7 usec/loop -> 9.32 usec/loop

  ./python.exe -m timeit -s 'from fractions import Fraction; f = Fraction(3, 2)' 'Fraction(f)'
31.9 usec/loop -> 14.3 usec/loop
2008-02-14 06:12:24 +00:00
Mark Dickinson 5f8bd3729e Replace R=fractions.Fraction with F=fractions.Fraction in
test_fractions.py.  This should have been part of the name
change from Rational to Fraction.
2008-02-12 21:46:54 +00:00
Mark Dickinson e1b824793a Implementation of Fraction.limit_denominator.
Remove Fraction.to_continued_fraction and
Fraction.from_continued_fraction
2008-02-12 21:31:59 +00:00
Mark Dickinson cd873fc142 Put an extra space into the repr of a Fraction:
Fraction(1, 2) instead of Fraction(1,2).
2008-02-11 03:11:55 +00:00
Mark Dickinson d058cd2cc8 Rename rational.Rational to fractions.Fraction, to avoid name clash
with numbers.Rational.  See issue #1682 for related discussion.
2008-02-10 21:29:51 +00:00