mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-19 23:28:32 -04:00
4f8d2059f8
We are calling fabsf(), which returns a float. We should use the epsilon from float type, not from the argument type passed to fabsf(). On the other hand when the double version is instantiated we do want to use the std::numeric_limits<double>::epsilon() value. This adds a branch to the function, but it's removed when the function is intantiated by the compiler since the type is known at compile-time. Fixes this warning when building for PX4: ../../libraries/AP_Math/AP_Math.cpp: In instantiation of 'typename std::enable_if<std::is_floating_point<typename std::common_type<_Tp, _Up>::type>::value, bool>::type is_equal(Arithmetic1, Arithmetic2) [with Arithmetic1 = double; Arithmetic2 = double; typename std::enable_if<std::is_floating_point<typename std::common_type<_Tp, _Up>::type>::value, bool>::type = bool]': ../../libraries/AP_Math/AP_Math.cpp:23:66: required from here ../../libraries/AP_Math/AP_Math.cpp:17:29: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion] return fabsf(v_1 - v_2) < std::numeric_limits<decltype(v_1 - v_2)>::epsilon(); ^ |
||
---|---|---|
.. | ||
benchmarks | ||
examples | ||
tests | ||
tools/geodesic_grid | ||
AP_GeodesicGrid.cpp | ||
AP_GeodesicGrid.h | ||
AP_Math.cpp | ||
AP_Math.h | ||
crc.cpp | ||
crc.h | ||
definitions.h | ||
edc.cpp | ||
edc.h | ||
keywords.txt | ||
location.cpp | ||
location.h | ||
matrix3.cpp | ||
matrix3.h | ||
matrix_alg.cpp | ||
polygon.cpp | ||
polygon.h | ||
quaternion.cpp | ||
quaternion.h | ||
rotations.h | ||
vector2.cpp | ||
vector2.h | ||
vector3.cpp | ||
vector3.h | ||
vectorN.h |