Linear interpolation

should we maybe extrapolate rather than interpolate? will this work properly if x == X(x.size - 1) or x == X(0)?