- Support for Python 2.7 as well as 3.7 and earlier has been removed.
- Generally use
.as_integer_ratio()
in the constructor if available. python/cpython#120271 - Add a classmethod
.from_number()
that requires a number argument, not a string. python/cpython#121800 - Mixed calculations with other
Rational
classes could return the wrong type. python/cpython#119189 - In mixed calculations with
complex
, the Fraction is now converted tofloat
instead ofcomplex
to avoid certain corner cases in complex calculation. python/cpython#119839 - Using
complex
numbers in division shows better tracebacks. python/cpython#102842 - Subclass instantiations and calculations could fail in some cases.
- New binary wheels were added built with gcc 12 (manylinux_2_28).
- x86_64 wheels now require SSE4.2.
- Built using Cython 3.0.10.
- Math operations were sped up by inlined binary GCD calculation.
- Formatting support was improved, following CPython 3.13a3 as of python/cpython#111320
- Add support for Python 3.13 by using Cython 3.0.8 and calling
math.gcd()
.
- Add support for Python 3.12 by using Cython 3.0.2.
- Implement
__format__
forFraction
, following python/cpython#100161 - Implement
Fraction.is_integer()
, following python/cpython#100488 Fraction.limit_denominator()
is faster, following python/cpython#93730- Internal creation of result Fractions is about 10% faster if the calculated numerator/denominator pair is already normalised, following python/cpython#101780
- Built using Cython 3.0.0b1.
- Parsing very long numbers from a fraction string was very slow, even slower
than
fractions.Fraction
. The parser is now faster in all cases (and still much faster for shorter numbers). Fraction
did not implement__int__
. https://bugs.python.org/issue44547
- Faster and more space friendly pickling and unpickling. https://bugs.python.org/issue44154
- Algorithmically faster arithmetic for large denominators, although slower for small fraction components. https://bugs.python.org/issue43420 Original patch for CPython by Sergey B. Kirpichev and Raymond Hettinger.
- Make sure
bool(Fraction)
always returns abool
. https://bugs.python.org/issue39274 - Built using Cython 3.0.0a10.
- Fix
OverflowError
when parsing string values with long decimal parts.
hash(fraction)
is substantially faster in Py3.8+, following an optimisation in CPython 3.9 (https://bugs.python.org/issue37863).- New method
fraction.as_integer_ratio()
.
- Substantially faster normalisation (and therefore instantiation) in Py3.5+.
//
(floordiv) now follows the expected rounding behaviour when used with floats (by converting to float first), and is much faster for integer operations.- Fix return type of divmod(), where the first item should be an integer.
- Further speed up mod and divmod operations.
- Faster mod and divmod calculation.
- Faster normalisation and fraction string parsing.
- Add support for Python 3.7.
- Built using Cython 0.29.
- Speed up Fraction creation from a string value by 3-5x.
- Built using Cython 0.28.1.
- Result of power operator (
**
) was not normalised for negative values. - Built using Cython 0.27.2.
- Rebuilt using Cython 0.26.1 to improve support of Python 3.7.
- repair the faster instantiation from Decimal values in Python 3.6
- avoid potential glitch for certain large numbers in normalisation under Python 2.x
- change hash function in Python 2.x to match that of
fractions.Fraction
- faster instantiation from float values
- faster instantiation from Decimal values in Python 3.6
Fraction.imag
property could return non-zero- parsing strings with long fraction parts could use an incorrect scale
- faster instantiation from float and string values
- fix test in Python 2.x
- faster normalisation (and thus instantiation)
- faster math operations
- enable legacy division support in Python 2.x
- minor behavioural fixes in corner cases under Python 2.x (now passes all test in Py2.7 as well)
- cache hash value of Fractions
- initial public release