def result_check(expected, got, ulp_tol=5, abs_tol=0.0):
 if (got == expected):
  return None
 failure = 'not equal'
 if (isinstance(expected, float) and isinstance(got, int)):
  got = float(got)
 elif (isinstance(got, float) and isinstance(expected, int)):
  expected = float(expected)
 if (isinstance(expected, float) and isinstance(got, float)):
  if (math.isnan(expected) and math.isnan(got)):
   failure = None
  elif (math.isinf(expected) or math.isinf(got)):
   pass
  else:
   failure = ulp_abs_check(expected, got, ulp_tol, abs_tol)
 if (failure is not None):
  fail_fmt = 'expected {!r}, got {!r}'
  fail_msg = fail_fmt.format(expected, got)
  fail_msg += ' ({})'.format(failure)
  return fail_msg
 else:
  return None

def result_check ( expected , got , ulp_tol = 5 , abs_tol = 0.0 ) : if ( got == expected ) : return None failure = 'not equal' if ( isinstance ( expected , float ) and isinstance ( got , int ) ) : got = float ( got ) elif ( isinstance ( got , float ) and isinstance ( expected , int ) ) : expected = float ( expected ) if ( isinstance ( expected , float ) and isinstance ( got , float ) ) : if ( math . isnan ( expected ) and math . isnan ( got ) ) : failure = None elif ( math . isinf ( expected ) or math . isinf ( got ) ) : pass else : failure = ulp_abs_check ( expected , got , ulp_tol , abs_tol ) if ( failure is not None ) : fail_fmt = 'expected {!r}, got {!r}' fail_msg = fail_fmt . format ( expected , got ) fail_msg += ' ({})' . format ( failure ) return fail_msg else : return None
compare arguments expected and got .