diff --git a/libs/kimath/include/geometry/eda_angle.h b/libs/kimath/include/geometry/eda_angle.h index 9cc7c483a6..06cd78e08f 100644 --- a/libs/kimath/include/geometry/eda_angle.h +++ b/libs/kimath/include/geometry/eda_angle.h @@ -135,17 +135,17 @@ public: bool IsZero() const { - return m_value == 0.0; + return equals( m_value, 0.0 ); } bool IsHorizontal() const { - return m_value == 0.0 || m_value == 180.0; + return equals( m_value, 0.0 ) || equals( m_value, 180.0 ); } bool IsVertical() const { - return m_value == 90.0 || m_value == 270.0; + return equals( m_value, 90.0 ) || equals( m_value, 270.0 ); } bool IsParallelTo( EDA_ANGLE aAngle ) const @@ -155,14 +155,16 @@ public: // Normalize90 is inclusive on both ends [-90, +90] // but we need it to be (-90, +90] for this test to work thisNormalized.Normalize90(); - if( thisNormalized.AsDegrees() == -90.0 ) + + if( equals( thisNormalized.AsDegrees(), -90.0 ) ) thisNormalized = EDA_ANGLE( 90.0, DEGREES_T ); aAngle.Normalize90(); - if( aAngle.AsDegrees() == -90.0 ) + + if( equals( aAngle.AsDegrees(), -90.0 ) ) aAngle = EDA_ANGLE( 90.0, DEGREES_T ); - return ( thisNormalized.AsDegrees() == aAngle.AsDegrees() ); + return ( equals( thisNormalized.AsDegrees(), aAngle.AsDegrees() ) ); } EDA_ANGLE Invert() const @@ -348,13 +350,13 @@ inline double operator/( const EDA_ANGLE& aAngleA, const EDA_ANGLE& aOperator ) inline bool operator==( const EDA_ANGLE& aAngleA, const EDA_ANGLE& aAngleB ) { - return aAngleA.AsDegrees() == aAngleB.AsDegrees(); + return equals( aAngleA.AsDegrees(), aAngleB.AsDegrees() ); } inline bool operator!=( const EDA_ANGLE& aAngleA, const EDA_ANGLE& aAngleB ) { - return aAngleA.AsDegrees() != aAngleB.AsDegrees(); + return !equals( aAngleA.AsDegrees(), aAngleB.AsDegrees() ); }