Interpolation Bug #10065
Labels
Framework
Issues and pull requests related to components in the Framework
High Priority
An issue or pull request that if not addressed is severe enough to postponse a release.
Milestone
From Michael Wedel via mantid help:
Hi,
I was using Kernel::Interpolation and I think I discovered a small bug
in Interpolation::value(), line 54. This line covers the case of values
above the upper interpolation interval limit.
Currently the line reads:
return m_y[N-1]+(at-m_y[N-1])*(m_y[N-1]-m_y[N-2])/(m_x[N-1]-m_x[N-2]);
----------------------^
I think it should read:
return m_y[N-1]+(at-m_x[N-1])*(m_y[N-1]-m_y[N-2])/(m_x[N-1]-m_x[N-2]);
----------------------^
Making this change breaks InterpolationTest::test1():
Line 31: TS_ASSERT_DELTA( interpolation.value(3000), 260400.0 ,0.000000001);
The test should then be adjusted like this:
Line 31: TS_ASSERT_DELTA( interpolation.value(3000), 28000.0 ,0.000000001);
Line 52: TS_ASSERT_DELTA( interpolation.value(3000), 28000.0 ,0.000000001);
I think this is just a typo, since subtracting a y-value from an x-value
would not make much sense and in all other cases in that method, x
values are subtracted from other x-values. Tomorrow I could write the
changes and open a pull-request on github.
Keywords: PatchCandidate
The text was updated successfully, but these errors were encountered: