Use Math.ceil instead of rounding

This commit is contained in:
Anh Dung Bui 2024-11-18 10:16:49 +09:00
parent ccd3e25c62
commit f9da336ed9
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ public class TwoPhaseKnnVectorQuery extends KnnFloatVectorQuery {
*/
public TwoPhaseKnnVectorQuery(
String field, float[] target, int k, double oversample, Query filter) {
super(field, target, k + (int) Math.round(k * oversample), filter);
super(field, target, k + (int) Math.ceil(k * oversample), filter);
if (oversample < 0) {
throw new IllegalArgumentException("oversample must be non-negative, got " + oversample);
}