ardupilot/libraries/AP_Math
Lucas De Marchi 4f8d2059f8 AP_Math: use right epsilon for is_equal()
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();
                             ^
2017-01-27 12:15:19 -08:00
..
benchmarks AP_Math: AP_GeodesicGrid: make all methods static 2016-05-16 19:08:36 -03:00
examples AP_Math: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
tests AP_Math: add some test for vector2 equality test 2016-12-20 14:09:04 +00:00
tools/geodesic_grid AP_Math: geodesic_grid tool: show triangle number for sections too 2016-05-18 13:28:52 -03:00
AP_GeodesicGrid.cpp AP_Math: fix some coding style mistakes 2016-05-16 19:08:36 -03:00
AP_GeodesicGrid.h AP_Math: fix some coding style mistakes 2016-05-16 19:08:36 -03:00
AP_Math.cpp AP_Math: use right epsilon for is_equal() 2017-01-27 12:15:19 -08:00
AP_Math.h AP_Math: is_equal correct comparison for integer as epsilon doesn't exist. 2016-12-20 14:09:04 +00:00
crc.cpp AP_Math: started a set of crc functions 2017-01-27 18:11:29 +11:00
crc.h AP_Math: started a set of crc functions 2017-01-27 18:11:29 +11:00
definitions.h AP_Math: add USEC_PER_MSEC 2016-07-30 00:55:28 -03:00
edc.cpp AP_Math: Fix typos 2016-05-13 19:20:06 -03:00
edc.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
keywords.txt Beginnings of a math library for ArduPilot(Mega) systems. 2010-09-08 08:21:46 +00:00
location.cpp Global: Aggregate the same definitions. 2016-11-09 11:46:55 -03:00
location.h Global: Aggregate the same definitions. 2016-11-09 11:46:55 -03:00
matrix3.cpp Global: To nullptr from NULL. 2016-11-02 16:04:47 -02:00
matrix3.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
matrix_alg.cpp AP_Math: Matrix_alg fix implicite cast from bool to float 2016-12-05 12:39:31 -08:00
polygon.cpp AP_Math: polygon.cpp correct float comparison 2016-12-06 09:31:21 -08:00
polygon.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
quaternion.cpp AP_Math: quaternion fix missing return 2016-12-05 10:33:41 -08:00
quaternion.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
rotations.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
vector2.cpp AP_Math: Vector2 add == operator for int 2016-12-06 09:31:21 -08:00
vector2.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
vector3.cpp AP_Math: define Vector3l for += op 2016-11-09 17:08:13 +11:00
vector3.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00
vectorN.h Global: remove mode line from headers 2016-10-24 09:42:01 -02:00