Skip to content

Commit ebd0861

Browse files
committed
Compare floats with allowable delta diff in VectorScorerFactoryTests
1 parent 55ade97 commit ebd0861

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libs/simdvec/src/test/java/org/elasticsearch/simdvec/VectorScorerFactoryTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
// @com.carrotsearch.randomizedtesting.annotations.Repeat(iterations = 100)
5151
public class VectorScorerFactoryTests extends AbstractVectorTestCase {
5252

53+
private static final float DELTA = 1e-5f;
54+
5355
// bounds of the range of values that can be seen by int7 scalar quantized vectors
5456
static final byte MIN_INT7_VALUE = 0;
5557
static final byte MAX_INT7_VALUE = 127;
@@ -278,7 +280,7 @@ void testRandomScorerImpl(long maxChunkSize, Function<Integer, float[]> floatArr
278280

279281
var expected = luceneScore(sim, qVectors[idx0], qVectors[idx1], correction, corrections[idx0], corrections[idx1]);
280282
var scorer = factory.getInt7SQVectorScorer(VectorSimilarityType.of(sim), values, vectors[idx0]).get();
281-
assertThat(scorer.score(idx1), equalTo(expected));
283+
assertEquals(scorer.score(idx1), expected, DELTA);
282284
}
283285
}
284286
}

0 commit comments

Comments
 (0)