summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-09-08 13:23:41 (GMT)
committerGitHub <noreply@github.com>2023-09-08 13:23:41 (GMT)
commit4cb29bb6832760bc021adc8b8e973e3f3e4d044e (patch)
tree49e9bd8169547c7ebc39ce3dd2e69235eb54c257 /Doc
parent2ce26121b1b7f19867988c6bd98d1761e57770b7 (diff)
downloadcpython-4cb29bb6832760bc021adc8b8e973e3f3e4d044e.zip
cpython-4cb29bb6832760bc021adc8b8e973e3f3e4d044e.tar.gz
cpython-4cb29bb6832760bc021adc8b8e973e3f3e4d044e.tar.bz2
[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 b72251de930c8ec6893f1b3f6fdf1640cc17dfed) Co-authored-by: Mark Dickinson <dickinsm@gmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/stdtypes.rst8
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 8043423..50f5660 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -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``.