def gcf(a, b, epsilon=1e-16):
    """Return the greatest common factor of a and b, using Euclidean algorithm.

    Arguments:
    a, b -- two numbers
            If both numbers are integers return an integer result, 
            otherwise return a float result.
    epsilon -- floats less than this magnitude are considered to be zero
               (default: 1e-16)

    Examples:

    >>> gcf(12, 34)
    2

    >>> gcf(13.5, 4)
    0.5

    >>> gcf(-2, 4)
    2

    >>> gcf(5, 0)
    5

    By (a convenient) definition:
    >>> gcf(0, 0)
    0

    """
    result = max(a, b)
    remainder = min(a, b)
    while remainder and abs(remainder) > epsilon:
        new_remainder = result % remainder
        result = remainder
        remainder = new_remainder
    return abs(result)