def compare_values(value1, value2, relative, absolute):
    """
    Compare two values with respect to a relative and an absolute deviation.
    :param value1: First value
    :param value2: Second value
    :param relative: Relative deviation (0..1)
    :param absolute: Absolute deviation (e.g. 1, -5.7, 100)
    :return: True is value1 is within valid deviation of value2, False if not
    """
    mi = min(value1, value2)
    ma = max(value1, value2)

    if ((ma * (1 - relative)) - absolute) < mi:
        return True
    else:
        return False