[3.12] gh-102823: Document return type of floor division on floats (GH-102824) (#109092)

gh-102823: Document return type of floor division on floats (GH-102824)
(cherry picked from commit b72251de93)

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-09-08 06:23:41 -07:00 committed by GitHub
parent 2ce26121b1
commit 4cb29bb683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -282,7 +282,7 @@ the operations, see :ref:`operator-summary`):
+---------------------+---------------------------------+---------+--------------------+
| ``x / y`` | quotient of *x* and *y* | | |
+---------------------+---------------------------------+---------+--------------------+
| ``x // y`` | floored quotient of *x* and | \(1) | |
| ``x // y`` | floored quotient of *x* and | \(1)\(2)| |
| | *y* | | |
+---------------------+---------------------------------+---------+--------------------+
| ``x % y`` | remainder of ``x / y`` | \(2) | |
@ -319,8 +319,10 @@ the operations, see :ref:`operator-summary`):
Notes:
(1)
Also referred to as integer division. The resultant value is a whole
integer, though the result's type is not necessarily int. The result is
Also referred to as integer division. For operands of type :class:`int`,
the result has type :class:`int`. For operands of type :class:`float`,
the result has type :class:`float`. In general, the result is a whole
integer, though the result's type is not necessarily :class:`int`. The result is
always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is
``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``.

View file

@ -0,0 +1,2 @@
Document the return type of ``x // y`` when ``x`` and ``y`` have type
:class:`float`.