Repository navigation
fix(query): float constants match equal floats only (#706) - #710
Merged
Merged
Conversation
A float constant in a pattern, written or bound with `$slot`, matched every stored float within an absolute `f64::EPSILON`, so `0.0` matched `1e-17` while `[(= ?v 0.0)]` did not. Compare with IEEE `==` in the executor's matcher and in the engine's plan and scan, as joins and predicates already do: `0.0` matches `-0.0`, nothing else changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq
This was referenced Oct 23, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
A rule call's float argument reaches the derived-cell match in the engine's scan, which no test covered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq
adityamukho
added a commit
that referenced
this pull request
Oct 23, 2026
Each PR raised the count from 1,771 to 1,772; merged together they add two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #706 (data-integrity; stays open until v2.0.10 is published).
Summary
A float constant in a pattern, whether written out or bound to a
$slot, matched every stored float within an absolutef64::EPSILON. As a result,[?e :m/x 0.0]returned an entity whose value is1e-17, while[(= ?v 0.0)]did not. Every site now compares with IEEE==, as joins, predicates and the indexes already do:src/query/datalog/matcher.rs(patterns in queries, rule bodies, andnot/orbodies)ValueConst::matches(plan.rs), andKeyTest::matchesandcell_matches(scan.rs)0.0still matches-0.0. A float constant still reads the whole float kind of the AVET range before filtering, so both zeros are found.Tests
join_rules_test: the oldfloat_constant_keeps_epsilon_matchis replaced byfloat_constant_matches_equal_floats_only(plus an_after_checkpointvariant: file, checkpoint, reopen). It covers a literal,-0.0, an=predicate, a rule body and a prepared$vbound to0.0and to1e-17.negation_equality_test: the body literal test now checks that0.0excludes0.0only, not1e-17.--features test-oraclepasses.cargo clippy --all-features -- -D warningsandcargo fmt --checkare clean. Codex review found no issues.CHANGELOG (Fixed), TEST_COVERAGE.md and the test count are synced. The docs-site PR and the
mainbackport follow.🤖 Generated with Claude Code
https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq