From d81fbae94290eb899a77090e2e2013b9859ec930 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Thu, 27 Oct 2016 09:33:46 +0200 Subject: [PATCH] newton-bisection robustness improvements --- src/libcore/spline.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/spline.cpp b/src/libcore/spline.cpp index f8e46a49..9e0bae78 100644 --- a/src/libcore/spline.cpp +++ b/src/libcore/spline.cpp @@ -157,7 +157,7 @@ Float sampleCubicInterp1D(size_t idx, const Float *values, size_t size, Float mi /* Invert CDF using Newton-Bisection */ while (true) { - if (!(b >= a && b <= c)) + if (!(b > a && b < c)) b = 0.5f * (a + c); /* CDF and PDF in Horner form */ @@ -210,7 +210,7 @@ Float sampleCubicInterp1DN(size_t idx, const Float *nodes, const Float *values, /* Invert CDF using Newton-Bisection */ while (true) { - if (!(b >= a && b <= c)) + if (!(b > a && b < c)) b = 0.5f * (a + c); /* CDF and PDF in Horner form */