aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--forcescheme.cpp3
-rw-r--r--scatterplot.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/forcescheme.cpp b/forcescheme.cpp
index 22ab293..9e3feaa 100644
--- a/forcescheme.cpp
+++ b/forcescheme.cpp
@@ -1,6 +1,7 @@
#include "mp.h"
#include <algorithm>
+#include <limits>
static const double EPSILON = 1e-3;
@@ -18,7 +19,7 @@ arma::mat mp::forceScheme(const arma::mat &D,
i[k] = j[k] = k;
}
- double prevDeltaSum = 1. / 0.;
+ double prevDeltaSum = std::numeric_limits<double>::infinity();
for (size_t iter = 0; iter < maxIter; iter++) {
double deltaSum = 0;
diff --git a/scatterplot.cpp b/scatterplot.cpp
index 97f2f41..acf9e36 100644
--- a/scatterplot.cpp
+++ b/scatterplot.cpp
@@ -2,6 +2,7 @@
#include <algorithm>
#include <cmath>
+#include <limits>
#include <QSGGeometryNode>
#include <QSGSimpleRectNode>
@@ -139,7 +140,7 @@ int QuadTree::nearestTo(float x, float y) const
if (q >= 0) return q;
}
- float dist = 1.0f / 0.0f;
+ float dist = std::numeric_limits<float>::infinity();
nearestTo(x, y, q, dist);
if (dist < BRUSHING_MAX_DIST * BRUSHING_MAX_DIST)
return q;