From 35f7a466e5fef4a0e6b4ad27a5ac888c8fac04db Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Sat, 2 May 2015 02:11:18 -0700 Subject: [PATCH] AP_Math: compiler warnings: apply is_zero(float) or is_equal(float) --- libraries/AP_Math/location.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Math/location.cpp b/libraries/AP_Math/location.cpp index 6a3087309c..558a5dc4a7 100644 --- a/libraries/AP_Math/location.cpp +++ b/libraries/AP_Math/location.cpp @@ -128,7 +128,7 @@ void location_update(struct Location &loc, float bearing, float distance) */ void location_offset(struct Location &loc, float ofs_north, float ofs_east) { - if (ofs_north != 0 || ofs_east != 0) { + if (!AP_Math::is_zero(ofs_north) || !AP_Math::is_zero(ofs_east)) { int32_t dlat = ofs_north * LOCATION_SCALING_FACTOR_INV; int32_t dlng = (ofs_east * LOCATION_SCALING_FACTOR_INV) / longitude_scale(loc); loc.lat += dlat; @@ -254,7 +254,7 @@ void wgsecef2llh(const Vector3d &ecef, Vector3d &llh) { const double p = sqrt(ecef[0]*ecef[0] + ecef[1]*ecef[1]); /* Compute longitude first, this can be done exactly. */ - if (p != 0) + if (!AP_Math::is_zero(p)) llh[1] = atan2(ecef[1], ecef[0]); else llh[1] = 0;