def almostEqualF(a, b, rel_err=2e-15, abs_err=5e-323):
 if math.isnan(a):
  return math.isnan(b)
 if math.isinf(a):
  return (a == b)
 if ((not a) and (not b)):
  return (math.copysign(1.0, a) == math.copysign(1.0, b))
 try:
  absolute_error = abs((b - a))
 except OverflowError:
  return False
 else:
  return (absolute_error <= max(abs_err, (rel_err * abs(a))))

def almostEqualF ( a , b , rel_err = 2e-15 , abs_err = 5e-323 ) : if math . isnan ( a ) : return math . isnan ( b ) if math . isinf ( a ) : return ( a == b ) if ( ( not a ) and ( not b ) ) : return ( math . copysign ( 1.0 , a ) == math . copysign ( 1.0 , b ) ) try : absolute_error = abs ( ( b - a ) ) except OverflowError : return False else : return ( absolute_error <= max ( abs_err , ( rel_err * abs ( a ) ) ) )
determine whether floating-point values a and b are equal to within a rounding error .