ChrisHegarty commented on code in PR #12727:
URL: https://github.com/apache/lucene/pull/12727#discussion_r1375318432


##########
lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java:
##########
@@ -70,7 +74,11 @@ public float compare(byte[] v1, byte[] v2) {
   COSINE {
     @Override
     public float compare(float[] v1, float[] v2) {
-      return (1 + cosine(v1, v2)) / 2;
+      double cosine = cosine(v1, v2) + 1.0;

Review Comment:
   Ok, ignore this. You just don’t want to lose precision for potentially 
really small numbers.



##########
lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java:
##########
@@ -70,7 +74,11 @@ public float compare(byte[] v1, byte[] v2) {
   COSINE {
     @Override
     public float compare(float[] v1, float[] v2) {
-      return (1 + cosine(v1, v2)) / 2;
+      double cosine = cosine(v1, v2) + 1.0;

Review Comment:
   Ok, ignore this. You just don’t want to lose precision for potentially 
really small numbers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to