The Haversine formula => Calculate distance between to WGS84 Points
I think might be helpful, today for a customer i do the Haversine formulas for Firebird Sql as a stored procedure.
This formula allow you to calculate the distance in meter between two WGS84 datum points(degree points of Earth).
You can call the procedure like this:
SELECT * FROM HAVERSINE_GENERIC(1, 45,474081, 9,179348, 45,456091, 9)