mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
[FSD] Use qFuzzyCompare for double comparison
fixes "warning: comparing floating point with == or != is unsafe"
This commit is contained in:
committed by
Mat Sutcliffe
parent
84ae160b14
commit
5decc7d917
@@ -36,12 +36,12 @@ namespace BlackCore
|
||||
static QString pdu() { return "#SB"; }
|
||||
|
||||
//! Properties @{
|
||||
double m_latitude = 0.0;
|
||||
double m_latitude = 0.0;
|
||||
double m_longitude = 0.0;
|
||||
int m_altitudeTrue = 0.0;
|
||||
int m_groundSpeed = 0.0;
|
||||
int m_groundSpeed = 0.0;
|
||||
double m_pitch = 0.0;
|
||||
double m_bank = 0.0;
|
||||
double m_bank = 0.0;
|
||||
double m_heading = 0.0;
|
||||
bool m_onGround = false;
|
||||
//! @}
|
||||
@@ -55,12 +55,12 @@ namespace BlackCore
|
||||
{
|
||||
return lhs.sender() == rhs.sender() &&
|
||||
lhs.receiver() == rhs.receiver() &&
|
||||
lhs.m_latitude == rhs.m_latitude &&
|
||||
lhs.m_longitude == rhs.m_longitude &&
|
||||
qFuzzyCompare(lhs.m_latitude, rhs.m_latitude) &&
|
||||
qFuzzyCompare(lhs.m_longitude, rhs.m_longitude) &&
|
||||
lhs.m_altitudeTrue == rhs.m_altitudeTrue &&
|
||||
lhs.m_pitch == rhs.m_pitch &&
|
||||
lhs.m_bank == rhs.m_bank &&
|
||||
lhs.m_heading == rhs.m_heading &&
|
||||
qFuzzyCompare(lhs.m_pitch, rhs.m_pitch) &&
|
||||
qFuzzyCompare(lhs.m_bank, rhs.m_bank) &&
|
||||
qFuzzyCompare(lhs.m_heading, rhs.m_heading) &&
|
||||
lhs.m_onGround == rhs.m_onGround;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackCore
|
||||
tokens.push_back(m_sender);
|
||||
tokens.push_back(QString::number(m_transponderCode));
|
||||
tokens.push_back(toQString(m_rating));
|
||||
tokens.push_back(QString::number(m_latitude, 'f', 5));
|
||||
tokens.push_back(QString::number(m_latitude, 'f', 5));
|
||||
tokens.push_back(QString::number(m_longitude, 'f', 5));
|
||||
tokens.push_back(QString::number(m_altitudeTrue));
|
||||
tokens.push_back(QString::number(m_groundSpeed));
|
||||
@@ -66,7 +66,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
double pitch = 0.0;
|
||||
double bank = 0.0;
|
||||
double bank = 0.0;
|
||||
double heading = 0.0;
|
||||
bool onGround = false;
|
||||
unpackPBH(tokens[8].toUInt(), pitch, bank, heading, onGround);
|
||||
|
||||
@@ -63,14 +63,14 @@ namespace BlackCore
|
||||
lhs.m_transponderMode == rhs.m_transponderMode &&
|
||||
lhs.m_transponderCode == rhs.m_transponderCode &&
|
||||
lhs.m_rating == rhs.m_rating &&
|
||||
lhs.m_latitude == rhs.m_latitude &&
|
||||
lhs.m_longitude == rhs.m_longitude &&
|
||||
qFuzzyCompare(lhs.m_latitude, rhs.m_latitude) &&
|
||||
qFuzzyCompare(lhs.m_longitude, rhs.m_longitude) &&
|
||||
lhs.m_altitudeTrue == rhs.m_altitudeTrue &&
|
||||
lhs.m_altitudePressure == rhs.m_altitudePressure &&
|
||||
lhs.m_groundSpeed == rhs.m_groundSpeed &&
|
||||
lhs.m_pitch == rhs.m_pitch &&
|
||||
lhs.m_bank == rhs.m_bank &&
|
||||
lhs.m_heading == rhs.m_heading &&
|
||||
lhs.m_groundSpeed == rhs.m_groundSpeed &&
|
||||
qFuzzyCompare(lhs.m_pitch, rhs.m_pitch) &&
|
||||
qFuzzyCompare(lhs.m_bank, rhs.m_bank) &&
|
||||
qFuzzyCompare(lhs.m_heading, rhs.m_heading) &&
|
||||
lhs.m_onGround == rhs.m_onGround;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user