Fix bug in covariance computation

When the computation of the covariance gives zero, it actually means
that it is infinite, so set it to a very large value (1e10).