loss of precission

nkanade:
d = R * c (where R is the radius of the Earth)

Slight issue here, the earth is not a sphere. However the error in radius from the mean is at most 0.25% which is fit for most purposes.