So i was trying to duplicate the distance formula on this page in C#.
http://www.movable-type.co.uk/scripts/latlong.html
This is for distance between two coordinates.
This is my code
int R = 6371;
double Lat1 = ((Double.Parse(SLat))*(Math.PI/180));
double Lat2 = ((Double.Parse(SLat2)) * (Math.PI / 180));
double deltaOmega = (Double.Parse(SLat) - Double.Parse(SLat2)) * (Math.PI / 180);
double deltaLambda = (Double.Parse(SLong) - Double.Parse(SLong2)) * (Math.PI / 180);
double a = Math.Sin(deltaOmega / 2) * Math.Sin(deltaOmega / 2)
+ Math.Cos(Lat1) * Math.Cos(Lat2)
* Math.Sin(deltaLambda / 2) * Math.Sin(deltaLambda/ 2);
double c = 2* Math.Atan2(Math.Sqrt(a), Math.Sqrt(1-a));
double dis = R * c;
but i keep getting a distance that is two decimal places off.
Can anyone verify that my translation of the equation is correct?