Equality for doubles. (Potentially KICAD-SV8)
This commit is contained in:
@@ -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() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user