diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-10-06 08:30:51 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-10-06 08:30:51 +0200 |
commit | 62285f807c8b9d260f28b97210703f38ae4cd0f7 (patch) | |
tree | a0cc069a6f60841e4062ae7797e6fb9d8e9a4e99 /spline/spline.cpp | |
parent | e25458c41baa82406bd4c3c6d9ec2db3c0c141f0 (diff) |
spline: fix some NaN results on Unix
Diffstat (limited to 'spline/spline.cpp')
-rw-r--r-- | spline/spline.cpp | 4 |
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; } |