diff --git a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp index f8cb6e7908860aec37774d0a5fde2af12392014a..4d853c61e348b11c94cce58704a5c70aac3f0d61 100644 --- a/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp +++ b/MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.cpp @@ -58,10 +58,10 @@ double PiecewiseLinearInterpolation::getValue(double pnt_to_interpolate) const { // search interval that has the point inside std::size_t interval_idx(std::numeric_limits<std::size_t>::max()); - if (pnt_to_interpolate < _supp_pnts.front()) { + if (pnt_to_interpolate <= _supp_pnts.front()) { interval_idx = 0; } else { - if (_supp_pnts.back() < pnt_to_interpolate) { + if (_supp_pnts.back() <= pnt_to_interpolate) { interval_idx = _supp_pnts.size() - 2; } else { auto const& it(std::lower_bound(_supp_pnts.begin(), _supp_pnts.end(), pnt_to_interpolate));