adapt the formula for linear interpolation