class_docstr: Exact rational type, currently only intended for internal use.
class_docstr_tok: ["Exact","rational","type",",","currently","only","intended","for","internal","use","."]
code: def __hash__(s):
      a, b = s._mpq_
      if sys.version_info >= (3, 2):
          inverse = pow(b, HASH_MODULUS - 2, HASH_MODULUS)
          if not inverse:
              h = sys.hash_info.inf
          else:
              h = (abs(a) * inverse) % HASH_MODULUS
          if a < 0:
              h = -h
          if h == -1:
              h = -2
          return h
      else:
          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))
  
imports: import operator
  import sys
  from .libmp import int_types, mpf_hash, bitcount, from_man_exp, HASH_MODULUS
label_desc: Use image node_id 6 for calling the mpq obj's underlying member method code with example usage: obj.__hash__(s) and returns: h, hash, hash, mpf_hash