Comment 1 for bug 1209521

Revision history for this message
Dominik Holenstein (holdom) wrote :

This is the C++ code for locate() in interpolation.hpp:
protected:
            Size locate(Real x) const {
                if (x < *xBegin_)
                    return 0;
                else if (x > *(xEnd_-1))
                    return xEnd_-xBegin_-2;
                else
                    return std::upper_bound(xBegin_,xEnd_-1,x)-xBegin_-1;
            }

This is our code of locate() in JQuantLib (AbstractInterpolation.java):
protected int locate(double x) /* @ReadOnly */ {
        if (x <= vx[0])
            return 0;
        else if (x > vx[vx.length-1])
            return vx.length-2;
        else
            return Sorting.binarySearchFromTo(vx, x, 0, vx.length-1)-1;
    }

Question:
We have to change the line 'if (x <= vx[0])' to 'if(x < vx[0]', right?

Dominik