summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-01-25 13:33:17 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-01-28 06:43:39 +0000
commit556ce647aacc635ea05bd6d6e030d93d341b5624 (patch)
tree457e37642e98f5ff6616ec7c6de2b960494112c4
parenteea67332da825306abd3e49450850abb323eb91c (diff)
loplugin:fpcomparison in vcl/
Change-Id: I29f8c2c0f19e2440565f5300deffc412faa5870e Reviewed-on: https://gerrit.libreoffice.org/21775 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--vcl/source/filter/sgvspln.cxx7
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
2 files changed, 5 insertions, 4 deletions
diff --git a/vcl/source/filter/sgvspln.cxx b/vcl/source/filter/sgvspln.cxx
index 84e65e3316e8..40f168ac614f 100644
--- a/vcl/source/filter/sgvspln.cxx
+++ b/vcl/source/filter/sgvspln.cxx
@@ -19,6 +19,7 @@
#include <tools/poly.hxx>
#include <memory>
+#include <rtl/math.hxx>
#include <sgvspln.hxx>
#include <cmath>
@@ -498,7 +499,7 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y,
if (n<2) return 4;
nm1=n-1;
for (i=0;i<=nm1;i++) if (x[i+1]<=x[i]) return 2; // should be strictly monotonically decreasing!
- if (y[n]!=y[0]) return 3; // begin and end should be equal!
+ if (!rtl::math::approxEqual(y[n],y[0])) return 3; // begin and end should be equal!
a.reset(new double[n+1]);
lowrow.reset(new double[n+1]);
@@ -577,8 +578,8 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond,
alphY=Marg02; betY=MargN2;
} break;
case 3: {
- if (x[n]!=x[0]) return 3;
- if (y[n]!=y[0]) return 4;
+ if (!rtl::math::approxEqual(x[n],x[0])) return 3;
+ if (!rtl::math::approxEqual(y[n],y[0])) return 4;
} break;
case 4: {
if (std::abs(Marg01)>=MAXROOT) {
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 53e52f1d437a..d78501278124 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -878,7 +878,7 @@ static void appendDouble( double fValue, OStringBuffer& rBuffer, sal_Int32 nPrec
sal_Int64 nInt = (sal_Int64)fValue;
fValue -= (double)nInt;
// optimizing hardware may lead to a value of 1.0 after the subtraction
- if( fValue == 1.0 || log10( 1.0-fValue ) <= -nPrecision )
+ if( rtl::math::approxEqual(fValue, 1.0) || log10( 1.0-fValue ) <= -nPrecision )
{
nInt++;
fValue = 0.0;