def compare_floats(a, b, absoulte_precision=1e-12, relative_precision=None):
    """ Returns true if the absolute difference between the numbers a and b is less than the precision.

    Arguments:
    a -- a float
    b -- a float

    Keyword Arguments (optional):
    absolute_precision -- the absolute precision, abs(a-b) of the comparison.
    relative_precision -- the relative precision, max(a,b)/min(a,b) - 1. of the comparison.

    Returns:
    True if the numbers are the same within the limits of the precision.
    False if the number are not the same within the limits of the precision.
    """
    if relative_precision is None:
        absolute = abs(a - b)
        if absolute < absoulte_precision:
            return True
        else:
            return False
    else:
        relative = max(a, b) / min(a, b) - 1.0
        if relative < relative_precision:
            return True
        else:
            return False
