use C++11s std::hypot() instead of hand-rolled code

This commit is contained in:
Dennis Luxen
2015-02-05 11:22:46 +01:00
parent 9f5fc4ab0c
commit bf76465029
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ float coordinate_calculation::euclidean_distance(const int lat1,
const float x_value = (float_lon2 - float_lon1) * cos((float_lat1 + float_lat2) / 2.f);
const float y_value = float_lat2 - float_lat1;
return sqrt(x_value * x_value + y_value * y_value) * earth_radius;
return std::hypot(x_value, y_value) * earth_radius;
}
float coordinate_calculation::perpendicular_distance(const FixedPointCoordinate &source_coordinate,