From 6c788c6ae0b9e72ae69ffff5e16d22fb971a2941 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 8 Aug 2024 12:45:17 +1000 Subject: [PATCH] AP_Math: correct warning on fabsF 2024-08-08T01:51:53.6780446Z ../../libraries/AP_Math/vector3.cpp:432:9: warning: absolute value function 'fabsf' given an argument of type 'const double' but has parameter of type 'float' which may cause truncation of value [-Wabsolute-value] 2024-08-08T01:51:53.6781336Z if (fabsF(cosv) >= 1) { 2024-08-08T01:51:53.6781583Z ^ 2024-08-08T01:51:53.6781930Z ../../libraries/AP_Math/ftype.h:50:18: note: expanded from macro 'fabsF' 2024-08-08T01:51:53.6782342Z #define fabsF(x) fabsf(x) 2024-08-08T01:51:53.6782572Z ^ 2024-08-08T01:51:53.6789178Z ../../libraries/AP_Math/vector3.cpp:633:16: note: in instantiation of member function 'Vector3::angle' requested here 2024-08-08T01:51:53.6789800Z template class Vector3; --- libraries/AP_Math/vector3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_Math/vector3.cpp b/libraries/AP_Math/vector3.cpp index 021b737a01..3c763008ee 100644 --- a/libraries/AP_Math/vector3.cpp +++ b/libraries/AP_Math/vector3.cpp @@ -429,7 +429,7 @@ T Vector3::angle(const Vector3 &v2) const return 0.0f; } const T cosv = ((*this)*v2) / len; - if (fabsF(cosv) >= 1) { + if (cosv >= 1 || cosv <= -1) { return 0.0f; } return acosF(cosv);