calculate the distance after standardizing