diff --git a/src/Geo/QGCGeo.cc b/src/Geo/QGCGeo.cc index 9621b7572ee886206935eae66ab0b7c7012e2b22..cbe1d14cc14cdee7d28c0f752ae8e0f9d10d2d9b 100644 --- a/src/Geo/QGCGeo.cc +++ b/src/Geo/QGCGeo.cc @@ -46,7 +46,7 @@ void convertGeoToNed(QGeoCoordinate coord, QGeoCoordinate origin, double* x, dou double ref_cos_lat = cos(ref_lat_rad); double c = acos(ref_sin_lat * sin_lat + ref_cos_lat * cos_lat * cos_d_lon); - double k = (abs(c) < epsilon) ? 1.0 : (c / sin(c)); + double k = (fabs(c) < epsilon) ? 1.0 : (c / sin(c)); *x = k * (ref_cos_lat * sin_lat - ref_sin_lat * cos_lat * cos_d_lon) * CONSTANTS_RADIUS_OF_EARTH; *y = k * cos_lat * sin(lon_rad - ref_lon_rad) * CONSTANTS_RADIUS_OF_EARTH; @@ -70,7 +70,7 @@ void convertNedToGeo(double x, double y, double z, QGeoCoordinate origin, QGeoCo double lat_rad; double lon_rad; - if (abs(c) > epsilon) { + if (fabs(c) > epsilon) { lat_rad = asin(cos_c * ref_sin_lat + (x_rad * sin_c * ref_cos_lat) / c); lon_rad = (ref_lon_rad + atan2(y_rad * sin_c, c * ref_cos_lat * cos_c - x_rad * ref_sin_lat * sin_c));