def compare(a, b, *, tol=1e-6):
    """
    if ||a - b|| < tol, return 0
    otherwise return float(a > b)
    """
    if abs(a - b) < tol:
        return 0.0
    elif a > b:
        return 1.0
    else:
        return -1.0

    if ||a - b|| < tol, return 0
    otherwise return float(a > b)
    
surreal/utils/numpy_util.py