Repository navigation
feat: resolve documented known gaps — abs, named constants, Field↔float, From vectors (sq-dtmg9) — v0.11.0 - #103
Merged
Merged
Conversation
…loat, From vectors, dead ct.nr (sq-dtmg9) [FABLE-5] Resolves the gaps documented in README 'Known gaps' + TESTING.md 'absent from the new public API' (maintainer directive 2026-07-06, sparq bead sq-dtmg9): - abs: IEEE 754-2019 5.5.1 quiet bit-level sign clear (payload-preserving), all four widths. - Named constant constructors zero/neg_zero/one/neg_one/infinity/neg_infinity/ nan/signaling_nan as comptime-constant struct literals (no gates), with the deprecated library's sNaN bit patterns and an honest no-signaling-semantics doc note. - from_field/to_field with LOUD semantics replacing the deprecated silent ones: from_field asserts value < 2^128 in-circuit then reuses the verified From<u128> RNE path; to_field truncates via the to_u64 kernel (NaN/inf/range rejection). - Vector generator: abs vectors (all widths, NaN-payload probes), integer-> float From<u8..u128,i8..i64> conversion vectors (fixing a TESTING.md overclaim — these were documented but did not exist), from_field/to_field vectors; fixture regenerated (1793 -> 3038 vectors, 121 -> 199 test fns). - Differential oracle: abs rows (f16/f32/f64), from_field rows (f32/f64, hardware RNE int->float casts as oracle), to_field rows (f32/f64); committed oracle regenerated (24 -> 31 test fns, ~5300 assertions); inject-fault self-test still proves non-vacuity. - Dead code: delete root-level ct.nr (unused duplicate of src/sizing.nr and home of the repo's only two stale TODOs). - Docs: README source-of-truth header (in-sparq copy removed by sparq#1602), public-API list, known-gaps section now pointing at beads sq-xs0pa (directed-rounding arithmetic, deferred: kernel-level feature needing a design decision + rustc_apfloat-class oracle) and sq-3x7dl.14.2 (f128 oracle rows); TESTING.md mapping moved abs/constants/Field rows from 'absent' (77) to 'covered' (192 of 229), counts refreshed. - Version 0.10.0 -> 0.11.0. Arithmetic kernels are UNTOUCHED, so the committed gate baselines remain valid; the additions are decode-only or comptime-constant. Gate-bench rows for the new ops are tracked as sq-hkhg8. Validated locally on pinned nargo 1.0.0-beta.21: nargo test 43/43, generated vectors 199/199, public API 9/9 + 4 rejections, private-fn lint clean, differential harness green incl. drift guard + fault-injection self-test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Resolves every gap documented in this repo's README Known gaps section and TESTING.md's absent from the new public API table, except directed-rounding arithmetic (deliberately deferred — see below). Version
0.10.0 -> 0.11.0.Gap resolutions
abs(10 unported deprecated tests)fabs); decode-only cost.zero/neg_zero/one/neg_one/infinity/neg_infinity/nan/signaling_nanas comptime-constant struct literals (no decode, no gates).signaling_nan()uses the deprecated library's bit patterns (0x7FA00000/0x7FF4000000000000) with an explicit doc note that this library implements no signaling semantics.from_fieldmod 2^64 and mapped NaN/negatives to 0):from_fieldassertsvalue < 2^128in-circuit (assert_max_bit_size::<128>) then reuses the verifiedFrom<u128>RNE path;to_fieldtruncates toward zero via theto_u64kernel, inheriting its NaN/inf/range rejections.ct.nrat repo rootsrc/sizing.nrand home of the repo's only two stale TODO comments (including a wrong exponent-size formula already fixed insizing.nr).zk/ieee754copy was removed by sparq#1602); header rewritten.From<u8..u128, i8..i64>)"from_field/to_fieldvectors. Honest note left in the mapping table.Deferred (documented, not guessed)
rndu/rndd/rndz/rnafor Add/Sub/Mul/Div; 37 deprecated tests) → sparq beadsq-xs0pa. This is a kernel-level feature needing a design decision, not an additive API: the rounding mode must be threaded throughround_pack_normalized{,_u64}in both kernels (mode-dependent overflow behaviour), the API shape (comptime-generic mode methods vs runtime parameter) has gate-budget consequences on the RNE hot path, and stable Rust has no directed-rounding host oracle (needsrustc_apfloat-class dependency). No SPARQL/XPath consumer needs non-RNE arithmetic today.sq-3x7dl.14.2. f128 remains covered by the exact-rational generated vectors (now including abs/from_field/to_field).sq-hkhg8(nobbon the work box; CI runs tests only). The arithmetic kernels are untouched, so the committed gate baselines remain valid — the additions are decode-only (abs), comptime-constant (constants), or compositions of already-measured kernels (from_field≈From<u128>,to_field≈to_u64).Test evidence (all on pinned
nargo 1.0.0-beta.21)nargo testshould_failrejection tests)Fromconversions, +from_field/to_field)from_fieldf32/f64 vs hardware RNE casts, +to_fieldf32/f64)cargo clippy --all-targetsclean.from_field/to_field/abscircuit paths are verified against two independent references: the exact-rational Python model (all 4 widths) and hardware IEEE 754 (f32/f64 via correctly-rounded Rust int→float casts).Notes for review
absintentionally does not canonicalise NaNs — IEEE abs is a quiet bit-level operation; both references agree.from_fieldrejects>= 2^128loudly rather than adopting the deprecated silent mod-2^64: the deprecated implementation was self-declared "not extensively tested, use with caution", and silent truncation contradicts this library's loud-failure discipline (same doctrine asto_u64/to_i64XPath rejections).differential/target/is now gitignored (previously only/target/was).Merging per the face-repo pattern once
test-summary+ required contexts are green; will tagv0.11.0and follow up with the sparqzk/composepin bump PR.🤖 Generated with Claude Code