Skip to content

Conversation

@sanikolaev
Copy link
Collaborator

@sanikolaev sanikolaev commented Nov 22, 2025

Implemented functions to compare floats and strings containing floats with tolerance which is required for different CPU architectures, allowing for more flexible equality checks. Added a global flag to disable float tolerance for strict comparisons.

Master branch:

✘ snikolaev@dev2  ~/manticore_github/test   master  searchd -v
Manticore 14.5.0 41ecead3a@25111812 dev (columnar 8.1.0 e1522a2@25100213) (secondary 8.1.0 e1522a2@25100213) (knn 8.1.0 e1522a2@25100213) (embeddings 1.0.1)
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2025, Manticore Software LTD (https://manticoresearch.com)

 snikolaev@dev2  ~/manticore_github/test   master  php ubertest.php -i /usr/bin/indexer -s /usr/bin/searchd t 298
PERFORMING AUTOMATED TESTING

testing test_298, knn quantization... done; 1/1 subtests FAILED:
	subtest 1: query results mismatch; see test_298/report.txt

To re-run failed tests only:
php ubertest.php t 298

1 of 1 tests and 1 of 2 subtests failed, 0 tests skipped, 0.85 sec elapsed
THERE WERE FAILURES!

 snikolaev@dev2  ~/manticore_github/test   master  egrep "\-|+" test_298/report.txt|tail
 sphinxql-162> select id, knn_dist() from t where knn(emp,3,(-0.11468425393104553,0.3873162567615509,-0.26252424716949463,0.007096240296959877,0.24166066944599152,-0.24653761088848114,0.060873936861753464,0.23045268654823303));
 	id	knn_dist()
-	8	0.30891573
+	8	0.30891579
 	7	0.39149725
-	9	0.49754488
+	9	0.49754483
 3 rows in set

=== query 162 diff end ===

Branch ubertest/float-tolerance

 snikolaev@dev2  ~/manticore_github/test   master  git checkout ubertest/float-tolerance
Branch 'ubertest/float-tolerance' set up to track remote branch 'ubertest/float-tolerance' from 'origin'.
Switched to a new branch 'ubertest/float-tolerance'
 snikolaev@dev2  ~/manticore_github/test   ubertest/float-tolerance  php ubertest.php -i /usr/bin/indexer -s /usr/bin/searchd t 298
PERFORMING AUTOMATED TESTING

testing test_298, knn quantization... done; 1/1 subtests OK

1 tests and 2 subtests succesful, 0 tests skipped, 1.06 sec elapsed
ALL OK

Implemented functions to compare floats and strings containing floats with tolerance which is required for different CPU architectures, allowing for more flexible equality checks. Added a global flag to disable float tolerance for strict comparisons.
@sanikolaev sanikolaev changed the title feat: add float comparison functions with tolerance float comparison functions with tolerance in ubertests Nov 22, 2025
@sanikolaev sanikolaev requested a review from glookka November 22, 2025 18:29
@glookka
Copy link
Contributor

glookka commented Nov 23, 2025

Test suite already has RoundFloatValues that is used for some cases, why not use it specifically for knn_dist case?

@sanikolaev
Copy link
Collaborator Author

Test suite already has RoundFloatValues that is used for some cases, why not use it specifically for knn_dist case?

Good idea. Done in 4460855

Copy link
Contributor

@glookka glookka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New version is better, however, it disables all float rounding using that new flag. This is wrong because RoundFloatValues must be used to round values in json result sets irregardless of the flag.

@sanikolaev
Copy link
Collaborator Author

@glookka

New version is better, however, it disables all float rounding using that new flag. This is wrong because RoundFloatValues must be used to round values in json result sets irregardless of the flag.

fixed in 222a5e2

@sanikolaev sanikolaev requested a review from glookka December 8, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants