Cosine Distance Optimizations
Reduced calls for same numbers
Reduced number of times Math.sqrt() is called since sqrt(x)*sqrt(y) ==
sqrt(x*y)