MCPcopy Create free account
hub / github.com/apache/impala / compare_float

Function compare_float

tests/common/test_result_verifier.py:193–200  ·  view source on GitHub ↗
(x, y, rel_tol=1e-9, abs_tol=0.0)

Source from the content-addressed store, hash-verified

191# If comparing against a float or double, don't do a strict comparison
192# See: https://peps.python.org/pep-0485/#proposed-implementation
193def compare_float(x, y, rel_tol=1e-9, abs_tol=0.0):
194 # For the purposes of test validation, we want to treat nans as equal. The
195 # floating point spec defines nan != nan.
196 if math.isnan(x) and math.isnan(y):
197 return True
198 if math.isinf(x) or math.isinf(y):
199 return x == y
200 return abs(x - y) <= max(rel_tol * max(abs(x), abs(y)), abs_tol)
201
202# Represents a column in a row
203class ResultColumn(object):

Callers 1

__eq__Method · 0.85

Calls 2

absFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected