Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3b055b59
Commit
3b055b59
authored
Jul 25, 2016
by
Berker Peksag
Browse files
Options
Browse Files
Download
Plain Diff
Issue #27601: Merge from 3.5
parents
ced8d4c6
aa46bd46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+11
-11
No files found.
Doc/library/stdtypes.rst
View file @
3b055b59
...
...
@@ -692,16 +692,16 @@ number, :class:`float`, or :class:`complex`::
m, n = m // P, n // P
if n % P == 0:
hash_ = sys.hash_info.inf
hash_
value
= sys.hash_info.inf
else:
# Fermat's Little Theorem: pow(n, P-1, P) is 1, so
# pow(n, P-2, P) gives the inverse of n modulo P.
hash_ = (abs(m) % P) * pow(n, P - 2, P) % P
hash_
value
= (abs(m) % P) * pow(n, P - 2, P) % P
if m < 0:
hash_
= -hash_
if hash_ == -1:
hash_ = -2
return hash_
hash_
value = -hash_value
if hash_
value
== -1:
hash_
value
= -2
return hash_
value
def hash_float(x):
"""Compute the hash of a float x."""
...
...
@@ -716,13 +716,13 @@ number, :class:`float`, or :class:`complex`::
def hash_complex(z):
"""Compute the hash of a complex number z."""
hash_ = hash_float(z.real) + sys.hash_info.imag * hash_float(z.imag)
hash_
value
= hash_float(z.real) + sys.hash_info.imag * hash_float(z.imag)
# do a signed reduction modulo 2**sys.hash_info.width
M = 2**(sys.hash_info.width - 1)
hash_
= (hash_ & (M - 1)) - (hash
& M)
if hash_ == -1:
hash_
=
= -2
return hash_
hash_
value = (hash_value & (M - 1)) - (hash_value
& M)
if hash_
value
== -1:
hash_
value
= -2
return hash_
value
.. _typeiter:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment