diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 2294921c443..d8c5b8b901b 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -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 @@ -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): """ diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index a4db716a1a6..083c93055ce 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -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"""