aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-02 17:42:04 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-02 17:42:04 -0200
commitdc50effe61c833da9c15b886d5ebba65620b99f0 (patch)
treebb5718d861b5765416ef0879c4f1d52bfec3560e
parented6386edd202de8ba3a737ce1e33499370edcaed (diff)
Using std::numeric_limits where appropriate.
-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;