summaryrefslogtreecommitdiffhomepage
path: root/spline
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-10-06 08:30:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-10-06 08:30:51 +0200
commit62285f807c8b9d260f28b97210703f38ae4cd0f7 (patch)
treea0cc069a6f60841e4062ae7797e6fb9d8e9a4e99 /spline
parente25458c41baa82406bd4c3c6d9ec2db3c0c141f0 (diff)
spline: fix some NaN results on Unix
Diffstat (limited to 'spline')
-rw-r--r--spline/spline.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index eacf4feb..21044b34 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -213,6 +213,10 @@ void spline::update_interp_data() const
const unsigned x = unsigned(f(.5) * cf * (cx[0] + cx[1] * t + cx[2] * t2 + cx[3] * t3));
const float y = (float)(f(.5) * (cy[0] + cy[1] * t + cy[2] * t2 + cy[3] * t3));
+ int ret = std::fpclassify(y);
+ if (ret == FP_NAN || ret == FP_INFINITE)
+ continue;
+
if (x < value_count)
data[x] = y;
}