Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-121905: Consistently use "floating-point" instead of "floating point" #121907

Merged
merged 8 commits into from
Jul 19, 2024
Prev Previous commit
Next Next commit
Merge branch 'main' into docs-floating-point
  • Loading branch information
serhiy-storchaka committed Jul 19, 2024
commit 469ece1fc457b26e56fba750a5e90e4b70f4b6fa
17 changes: 11 additions & 6 deletions Doc/library/fractions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ another rational number, or from a string.
The first version requires that *numerator* and *denominator* are instances
of :class:`numbers.Rational` and returns a new :class:`Fraction` instance
with value ``numerator/denominator``. If *denominator* is ``0``, it
raises a :exc:`ZeroDivisionError`. The second version requires that
*other_fraction* is an instance of :class:`numbers.Rational` and returns a
:class:`Fraction` instance with the same value. The next two versions accept
either a :class:`float` or a :class:`decimal.Decimal` instance, and return a
:class:`Fraction` instance with exactly the same value. Note that due to the
usual issues with binary floating point (see :ref:`tut-fp-issues`), the
raises a :exc:`ZeroDivisionError`.

The second version requires that *number* is an instance of
:class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method
(this includes :class:`float` and :class:`decimal.Decimal`).
It returns a :class:`Fraction` instance with exactly the same value.
Assumed, that the :meth:`!as_integer_ratio` method returns a pair
of coprime integers and last one is positive.
Note that due to the
usual issues with binary
point (see :ref:`tut-fp-issues`), the
argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so
``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might expect.
(But see the documentation for the :meth:`limit_denominator` method below.)
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.