Compute robust linear interpolation with edge cases | Two Sigma