This routine calculates the distance between two points given the. Latitudelongitude of those points. Now that you have the latitude and longitude values in decimals you just face the equation for the nautical miles between Timbuktu and Casablanca noted underneath.
This distance between two latlongs is based on some level of abstraction and its not an exact distance which is unattainable if you are considering all the irregularities on the surface of earth.
However the Earth is slightly elliptical in shape and that creates a small variation between the degrees as we work our way from the equator to the north and south poles. Each degree of latitude is approximately 69 miles 111 kilometers apart. A minute is thus 694460 1157 miles and a second is 11560 00193 miles or about 101 feet. The calculator uses Haversine formula to calculate the distance between the two locations entered.