summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-18 05:44:18 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-18 05:44:18 +0200
commit297794e9a885c7e0574462aa27e23a90bc84f039 (patch)
treefab469c51b7b69ed4d4449276a38c7f9f648b3c7
parent22857e786cd7462eb087cf039cefd36076784280 (diff)
qfc: elide NaN values
-rw-r--r--qfunctionconfigurator/functionconfig.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp
index 33f9beee..8c0bbc9f 100644
--- a/qfunctionconfigurator/functionconfig.cpp
+++ b/qfunctionconfigurator/functionconfig.cpp
@@ -67,6 +67,18 @@ static bool sortFn(const QPointF& one, const QPointF& two) {
return one.x() < two.x();
}
+static inline bool nanp(double value)
+{
+ return std::isnan(value) || std::isinf(value);
+}
+
+static inline double elide_nan(double value)
+{
+ if (nanp(value))
+ return -1;
+ return value;
+}
+
void Map::reload() {
if (cur.input.size())
{
@@ -124,7 +136,7 @@ void Map::reload() {
(-p0_y + 3. * p1_y - 3. * p2_y + p3_y) * t3);
if (x >= 0 && x < sz)
- data[x] = y;
+ data[x] = elide_nan(y);
}
}