Since our application is highly dependent on accurate GPS locations and distances, it was very important to accurately calculate distances around the globe for two locations that are very far away.

The naive way of doing it is to extrapolate the earth to be a sphere and easily find the distance using simple equations. Here is a short explanation about that.

This will work great for locations that are very close to each other, but we wanted to be able to measure distances all around the globe (*World Wide* Quest).
To do that you need to forget about the sphere and see the earth as it is an ellipsoid.
This makes the math a hell of a lot more trickier and requires approximation methods to be used.
Luckily, a great mathematician called Vincenty came to aid and created a great algorithm that we use to do the job.

Many thanks to these guys for implementing it in the code:
http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/