예제 #1
0
 def __hash__(s):
     a, b = s._mpq_
     if b == 1:
         return hash(a)
     # Power of two: mpf compatible hash
     if not (b & (b - 1)):
         return mpf_hash(from_man_exp(a, 1 - bitcount(b)))
     return hash((a, b))
예제 #2
0
파일: rational.py 프로젝트: Aang/sympy
 def __hash__(s):
     a, b = s._mpq_
     if b == 1:
         return hash(a)
     # Power of two: mpf compatible hash
     if not (b & (b-1)):
         return mpf_hash(from_man_exp(a, 1-bitcount(b)))
     return hash((a,b))
예제 #3
0
 def __hash__(s):
     return mpf_hash(s._mpf_)
예제 #4
0
 def __hash__(s): return mpf_hash(s._mpf_)
 def __int__(s): return int(to_int(s._mpf_))