Repository navigation
fix(query): float constants match equal floats only (#706) — backport - #711
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 `==`, 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
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq
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.
Backport of #710 to v2.x (issue #706, data-integrity; stays open until v2.0.10 is published).
Summary
On
mainthe only site issrc/query/datalog/matcher.rs. A float constant in a pattern, whether written out or bound to a$slot, matched every stored float withinf64::EPSILON. It now compares with IEEE==, as joins and predicates do.0.0still matches-0.0.Tests
tests/float_constant_test.rs(2 tests) covers a literal,-0.0, an=predicate, a rule body, anotbody and a prepared$vbound to0.0and to1e-17. It runs in memory and on file before and after a checkpoint and after reopen. Both tests fail before the fix.cargo clippy --all-features -- -D warningsandcargo fmt --checkare clean.CHANGELOG (Unreleased → Fixed), TEST_COVERAGE.md and the test count are synced.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WvnzWaNkVaLTTAMBM4jAaq