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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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) | |
Expand Down Expand Up @@ -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``.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document the return type of ``x // y`` when ``x`` and ``y`` have type
:class:`float`.