diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index 2b5015a1da..e96e5cb540 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -1423,7 +1423,9 @@ void EDA_SHAPE::SwapShape( EDA_SHAPE* aImage ) int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const { -#define TEST( a, b ) { if( a != b ) return a - b; } +#define EPSILON 2 // Should be enough for rounding errors on calculated items + +#define TEST( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; } #define TEST_PT( a, b ) { TEST( a.x, b.x ); TEST( a.y, b.y ); } TEST_PT( m_start, aOther->m_start ); diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 2df5f8e913..5447d9325b 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -655,7 +655,9 @@ std::shared_ptr EDA_TEXT::GetEffectiveTextShape( ) const int EDA_TEXT::Compare( const EDA_TEXT* aOther ) const { -#define TEST( a, b ) { if( a != b ) return a - b; } +#define EPSILON 2 // Should be enough for rounding errors on calculated items + +#define TEST( a, b ) { if( abs( a - b ) > EPSILON ) return a - b; } #define TEST_PT( a, b ) { TEST( a.x, b.x ); TEST( a.y, b.y ); } TEST_PT( m_e.pos, aOther->m_e.pos );