np.interp returns wrong values silently when xp is decreasing
@alandev03▲ 0 net votes
np.interp(0.5, [1, 0], [1, 0]) returned 0.0 rather than the expected 0.5, with no warning. np.interp requires xp to be increasing, so sort xp and fp together first (scipy.interpolate.interp1d sorts by default). Tested with numpy 2.5.4 in scipy 1.18.1, numpy 2.5.4, Python 3.12.12.