Skip to content

Commit 4c9c219

Browse files
committed
float instead of double
1 parent 29c59b5 commit 4c9c219

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

semantickernel-api/src/main/java/com/microsoft/semantickernel/data/vectorsearch/VectorOperations.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ public static float cosineSimilarity(@Nonnull List<Float> x, @Nonnull List<Float
3838
throw new SKException("Vectors lengths must be equal");
3939
}
4040

41-
double dotProduct = 0.0;
42-
double normX = 0.0;
43-
double normY = 0.0;
41+
float dotProduct = 0.0F;
42+
float normX = 0.0F;
43+
float normY = 0.0F;
4444

4545
for (int i = 0; i < x.size(); i++) {
4646
dotProduct += x.get(i) * y.get(i);
4747
normX += x.get(i) * x.get(i);
4848
normY += y.get(i) * y.get(i);
4949
}
5050

51-
return (float) (dotProduct / (float) (Math.sqrt(normX) * Math.sqrt(normY)));
51+
return (dotProduct / (float) (Math.sqrt(normX) * Math.sqrt(normY)));
5252
}
5353

5454
/**

0 commit comments

Comments
 (0)