computing difference to average last position