Handle edge-cases in linear interpolation.