import math


def cwt(a, b, tolerance = 1e-9):
    """
    compare_with_tolerance
    For the float value comparing, there are some situlation that two values are actually the same but been shown
    differently, e.g 1.230 and 1.2300000000000001. Especially after some calculation. This function is used to
    compare two float value with some tolerance
    Parameters
    ----------
    a           : float
                  the first value
    b           : float
                  the second value
    tolerance   : float
                  tolerance for the comparing

    Returns
    -------
    if_bigger_than  : int
                      if a is bigger than b
                      1: a > b
                      0: a == b
                      -1: a < b
    """
    tolerance = math.fabs(tolerance)
    if a - b > tolerance:
        return 1
    elif a - b < -tolerance:
        return -1
    else:
        return 0