From ae7332f958250cdf96a738b72b7b20198dabaae1 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Sat, 23 May 2020 23:50:23 -0600 Subject: [PATCH 1/2] bpo-39301: State that floor division is used for right shift operations --- Doc/library/stdtypes.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 4e7729c83f49a4..bb8b8f095c6928 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -438,8 +438,8 @@ Notes: without overflow check. (3) - A right shift by *n* bits is equivalent to division by ``pow(2, n)`` without - overflow check. + A right shift by *n* bits is equivalent to floor division by ``pow(2, n)`` + without overflow check. (4) Performing these calculations with at least one extra sign extension bit in From 3b9ea45e4bcbd96b0ab8eb157de86c137cd38dad Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Tue, 26 May 2020 00:22:59 -0600 Subject: [PATCH 2/2] Remove "without overflow check" --- Doc/library/stdtypes.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index bb8b8f095c6928..6a9fdcb38d24b7 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -434,12 +434,10 @@ Notes: Negative shift counts are illegal and cause a :exc:`ValueError` to be raised. (2) - A left shift by *n* bits is equivalent to multiplication by ``pow(2, n)`` - without overflow check. + A left shift by *n* bits is equivalent to multiplication by ``pow(2, n)``. (3) - A right shift by *n* bits is equivalent to floor division by ``pow(2, n)`` - without overflow check. + A right shift by *n* bits is equivalent to floor division by ``pow(2, n)``. (4) Performing these calculations with at least one extra sign extension bit in