Residential latitude and longitude are based on the patient's zip code centroid or on the city if the zip code was not available. Hospital locations are based on the street address for the facility. The great circle distance is calculated between those two points. In some instances, the residential city is outside of the United States, so the upper bound of distance may be quite large. A distance of 0 can result when the patient lives in the same zip code where the facility is located.
The Haversine (half-versed-sine) formula is used to calculate the distance between the two locations. It was published by R W Sinnott in Sky and Telescope, 1984, though known about for much longer by navigators.