From d4d7d1f73470997eded1faa906763d35fc62c8f8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 May 2018 08:10:30 +1000 Subject: [PATCH] AP_Math: avoid double maths when not needed --- libraries/AP_Math/AP_Math.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/AP_Math/AP_Math.cpp b/libraries/AP_Math/AP_Math.cpp index 2db5a00fbeb..abe8a72d82a 100644 --- a/libraries/AP_Math/AP_Math.cpp +++ b/libraries/AP_Math/AP_Math.cpp @@ -23,11 +23,13 @@ template typename std::enable_if::type>::value, bool>::type is_equal(const Arithmetic1 v_1, const Arithmetic2 v_2) { +#ifdef ALLOW_DOUBLE_MATH_FUNCTIONS typedef typename std::common_type::type common_type; typedef typename std::remove_cv::type common_type_nonconst; if (std::is_same::value) { return fabs(v_1 - v_2) < std::numeric_limits::epsilon(); } +#endif return fabsf(v_1 - v_2) < std::numeric_limits::epsilon(); }