From 62285f807c8b9d260f28b97210703f38ae4cd0f7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 6 Oct 2019 08:30:51 +0200 Subject: spline: fix some NaN results on Unix --- spline/spline.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spline') 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; } -- cgit v1.2.3