sqrt(one-(dotprods[j]*dotprods[j])));


If these were dot products of unit vectors, then dotprods[i] == cos(theta), where theta is the angle between the unit vectors.

In that specific case,...