datalog: arith / by zero raises instead of returning inf
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s
`is(R, /(X, 0))` was silently producing IEEE infinity:
(dl-eval "p(10). q(R) :- p(X), is(R, /(X, 0))." "?- q(R).")
=> ({:R inf})
That value then flowed through comparisons (anything < inf, anything
> inf) and aggregations (sum of inf, max of inf) producing nonsense
results downstream. `dl-eval-arith` now checks the divisor before
the host `/` and raises "division by zero in <expr>" — surfacing
the bug at its source rather than letting infinity propagate.
1 new test; conformance 264/264.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ for rose-ash data (e.g. federation graph, content relationships).
|
||||
|
||||
## Status (rolling)
|
||||
|
||||
`bash lib/datalog/conformance.sh` → **263/263 across 11 suites**
|
||||
`bash lib/datalog/conformance.sh` → **264/264 across 11 suites**
|
||||
(tokenize, parse, unify, eval, builtins, semi_naive, negation, aggregates,
|
||||
api, magic, demo). Source is ~3100 LOC, tests ~2900 LOC, public API
|
||||
documented in `lib/datalog/datalog.sx`.
|
||||
@@ -320,6 +320,12 @@ large graphs.
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-11 — Division by zero in `is` silently produced IEEE
|
||||
infinity instead of raising. `is(R, /(X, 0))` returned `R = inf`,
|
||||
which then flowed through comparisons and aggregations to produce
|
||||
nonsense results. `dl-eval-arith` now raises with a clear
|
||||
"division by zero in <expr>" message. 1 new test; 264/264.
|
||||
|
||||
- 2026-05-11 — Aggregate variable validation: `count(N, Y, p(X))`
|
||||
silently returned `N = 1` because `Y` was never bound in `p(X)` —
|
||||
every match contributed the same unbound symbol, which dl-val-member?
|
||||
|
||||
Reference in New Issue
Block a user