From 464bc9e8f46c971c013e128d6bc0d06b25452124 Mon Sep 17 00:00:00 2001 From: MrPresent-Han <116052805+MrPresent-Han@users.noreply.github.com> Date: Fri, 8 Dec 2023 10:04:37 +0800 Subject: [PATCH] fix: fix reduce precision for search(#27325) (#29031) related: #27325 Signed-off-by: MrPresent-Han --- internal/core/src/segcore/ReduceStructure.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/core/src/segcore/ReduceStructure.h b/internal/core/src/segcore/ReduceStructure.h index 48655f2aa7..cdcb0da813 100644 --- a/internal/core/src/segcore/ReduceStructure.h +++ b/internal/core/src/segcore/ReduceStructure.h @@ -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_;