haversine distance Algorithm

The first table of haversines in English was published by James Andrew in 1805, but Florian Cajori credits an earlier purpose by José de Mendoza Y Ríos in 1801.Prior to the advent of computers, the elimination of division and multiplication by factors of two proved convenient enough that tables of haversine values and logarithms were included in 19th- and early 20th-century navigation and trigonometric texts.

haversine distance source code, pseudocode and analysis