fix: fix reduce precision for search(#27325) (#29031)

related: #27325

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
This commit is contained in:
MrPresent-Han 2023-12-08 10:04:37 +08:00 committed by GitHub
parent c4dda3c50f
commit 464bc9e8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,10 +44,7 @@ struct SearchResultPair {
bool
operator>(const SearchResultPair& other) const {
//according to FLT_EPSILON in cfloat, 0.000000119 is the maximum flaw for float32
//we use this to differentiate distances that are too close to each other to maintain the
//stable order for reduce
if (std::fabs(distance_ - other.distance_) < 0.000000119) {
if (std::fabs(distance_ - other.distance_) < 0.0000000119) {
return primary_key_ < other.primary_key_;
}
return distance_ > other.distance_;