Kaydet (Commit) e0846b7a authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:simplifybool can't invert conditions involving float types

so revert some of the changes from

    commit 7a1c21e5
    loplugin:simplifybool for negation of comparison operator

Change-Id: I937d575b86c1e418805d399b0dc16ae91876b4fe
Reviewed-on: https://gerrit.libreoffice.org/45130Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 1db2cdd9
......@@ -142,6 +142,10 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
// RecordType would require more smarts - we'd need to verify that an inverted operator actually existed
if (t->isTemplateTypeParmType() || t->isRecordType() || t->isDependentType())
return true;
// for floating point (with NaN) !(x<y) need not be equivalent to x>=y
if (t->isFloatingType() ||
binaryOp->getRHS()->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType()->isFloatingType())
return true;
if (!binaryOp->isComparisonOp())
return true;
report(
......
......@@ -15,7 +15,16 @@ void f1(int a, int b)
}
};
// Consitently either warn about all or none of the below occurrences of "!!":
void f2(float a, float b)
{
// no warning expected
if (!(a < b))
{
a = b;
}
};
// Consistently either warn about all or none of the below occurrences of "!!":
enum E1
{
......
......@@ -395,7 +395,7 @@ void CGM::ImplDoClass4()
fStartAngle = fEndAngle;
fEndAngle = fG;
}
if ( ( fInterAngle <= fStartAngle ) && ( fInterAngle < fEndAngle ) )
if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
{
nSwitch ^=1;
aIntermediatePoint = aEndingPoint;
......@@ -465,7 +465,7 @@ void CGM::ImplDoClass4()
fStartAngle = fEndAngle;
fEndAngle = fG;
}
if ( ( fInterAngle <= fStartAngle ) && ( fInterAngle < fEndAngle ) )
if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
{
aIntermediatePoint = aEndingPoint;
aEndingPoint = aStartingPoint;
......
......@@ -170,7 +170,7 @@ bool isRepresentableInteger(double fAbsValue)
// this here.
double fInt;
return (nInt <= kMaxInt &&
(((fInt = static_cast< double >(nInt)) >= fAbsValue) && (fInt <= fAbsValue)));
(!((fInt = static_cast< double >(nInt)) < fAbsValue) && !(fInt > fAbsValue)));
}
return false;
}
......
......@@ -2368,7 +2368,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
{
if (::rtl::math::isSignBitSet(fNumber))
{
if (fNumber >= 0.0)
if (!(fNumber < 0.0))
fNumber = -fNumber; // do not display -0.0
}
if (fNumber == 0.0)
......
......@@ -59,11 +59,11 @@ void B3dTransformationSet::Orientation(basegfx::B3DHomMatrix& rTarget, const bas
void B3dTransformationSet::Frustum(basegfx::B3DHomMatrix& rTarget, double fLeft, double fRight, double fBottom, double fTop, double fNear, double fFar)
{
if(fNear <= 0.0)
if(!(fNear > 0.0))
{
fNear = 0.001;
}
if(fFar <= 0.0)
if(!(fFar > 0.0))
{
fFar = 1.0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment