Skip to content

bpo-39301: State that floor division is used for right shift operations #20347

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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