import math


def haversine(startpos,endpos):
    """Returns the distance between two tupled GPS coordinates.

    Args:
        startpos: the starting gps-coordinate point; in tuple form of 
            (latitude, longitude). Both need to be an int or float.
        endpos: the starting gps-coordinate point; in tuple form of (latitude,
            longitude). Both need to be an int or float.

    The formula used was found on Wikipedia
        (https://en.wikipedia.org/wiki/Haversine_formula).
    """
    lat1 = math.radians(startpos[0])
    lon1 = math.radians(startpos[1])
    lat2 = math.radians(endpos[0])
    lon2 = math.radians(endpos[1])
    r = 3440.065    # mean radius of earth in nmi
    d = 2 * r * math.asin(math.sqrt(math.pow(math.sin((lat2 - lat1)/2),2) + math.cos(lat1) * math.cos(lat2) * math.pow(math.sin((lon2-lon1)/2),2)))
    return d