def extract_operands(source):
 n = abs(source)
 i = int(n)
 if isinstance(n, float):
  if (i == n):
   n = i
  else:
   n = decimal.Decimal(str(n))
 if isinstance(n, decimal.Decimal):
  dec_tuple = n.as_tuple()
  exp = dec_tuple.exponent
  fraction_digits = (dec_tuple.digits[exp:] if (exp < 0) else ())
  trailing = ''.join((str(d) for d in fraction_digits))
  no_trailing = trailing.rstrip('0')
  v = len(trailing)
  w = len(no_trailing)
  f = int((trailing or 0))
  t = int((no_trailing or 0))
 else:
  v = w = f = t = 0
 return (n, i, v, w, f, t)

def extract_operands ( source ) : n = abs ( source ) i = int ( n ) if isinstance ( n , float ) : if ( i == n ) : n = i else : n = decimal . Decimal ( str ( n ) ) if isinstance ( n , decimal . Decimal ) : dec_tuple = n . as_tuple ( ) exp = dec_tuple . exponent fraction_digits = ( dec_tuple . digits [ exp : ] if ( exp < 0 ) else ( ) ) trailing = '' . join ( ( str ( d ) for d in fraction_digits ) ) no_trailing = trailing . rstrip ( '0' ) v = len ( trailing ) w = len ( no_trailing ) f = int ( ( trailing or 0 ) ) t = int ( ( no_trailing or 0 ) ) else : v = w = f = t = 0 return ( n , i , v , w , f , t )
extract operands from a decimal .