import math


def haversine(x1, y1, x2, y2):
    """Haversine distance formula"""
    x_dist = math.radians(x1 - x2)
    y_dist = math.radians(y1 - y2)
    y1_rad = math.radians(y1)
    y2_rad = math.radians(y2)
    a = math.sin(y_dist/2)**2 + math.sin(x_dist/2)**2 \
        * math.cos(y1_rad) * math.cos(y2_rad)
    c = 2 * math.asin(math.sqrt(a))
    # Distance in miles. Just use c * 6371
    # for kilometers
    distance = c * (6371/1.609344)  # Miles
    return distance