Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
py3: fix some doctests about hash for complex and real double
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Feb 26, 2019
1 parent 217cb83 commit b7fd196
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/sage/rings/complex_double.pyx
Expand Up @@ -125,6 +125,7 @@ def is_ComplexDoubleField(x):
"""
return isinstance(x, ComplexDoubleField_class)


cdef class ComplexDoubleField_class(sage.rings.ring.Field):
"""
An approximation to the field of complex numbers using double
Expand Down Expand Up @@ -202,13 +203,16 @@ cdef class ComplexDoubleField_class(sage.rings.ring.Field):
"""
Return the hash for ``self``.
This class is intended for use as a singleton so any instance
of it should be equivalent from a hashing perspective.
TESTS::
sage: hash(CDF) % 2^32 == hash(str(CDF)) % 2^32
sage: from sage.rings.complex_double import ComplexDoubleField_class
sage: hash(CDF) == hash(ComplexDoubleField_class())
True
"""
return 561162115
#return hash(self.str())

def characteristic(self):
"""
Expand Down
8 changes: 6 additions & 2 deletions src/sage/rings/real_double.pyx
Expand Up @@ -522,12 +522,16 @@ cdef class RealDoubleField_class(Field):
"""
Return the hash value of ``self``.
This class is intended for use as a singleton so any instance
of it should be equivalent from a hashing perspective.
TESTS::
sage: hash(RDF) % 2^32 == hash(str(RDF)) % 2^32
sage: from sage.rings.real_double import RealDoubleField_class
sage: hash(RDF) == hash(RealDoubleField_class())
True
"""
return 1157042230 #return hash(str(self))
return 1157042230

def pi(self):
r"""
Expand Down

0 comments on commit b7fd196

Please sign in to comment.