Skip to content

chore: first face re-sync since transfer — #1558 underflow fix + full drift - #101

Merged
jeswr merged 1 commit into
mainfrom
resync/sq-ev2hm
Jul 5, 2026
Merged

jeswr merged 1 commit into
mainfrom
resync/sq-ev2hm

Conversation

@jeswr

@jeswr jeswr commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

🤖 SPARQ agent — FIRST face re-sync of noir_IEEE754 since its transfer to sparq-org (bead sq-ev2hm). Ports drift from sparq PR #1558 (kernels.nr underflow fix + lib.nr regression tests) plus all accumulated drift since transfer. Nargo 1.0.0-beta.21 tests: 32/32 in-source tests passing (up from 29 at transfer time, +3 new underflow regression tests). (Pattern per sq-egw8o/sq-tlu1z prior art.)

Summary

Full recursive diff between sparq-org/sparq:zk/ieee754/ (canonical in-tree source) and this standalone repo. Only the Noir source files had drift — from sparq PR #1558 "fix(zk/ieee754): f128 mul/div flush deep-underflow to signed zero".

Changes ported

src/ops/kernels.nr — adds saturating_biased_exponent(sum: u32, subtrahend: u32) -> u16 helper and applies it in three call sites (f128 mul kernel, f128 div kernel, narrow-format mul/div kernels). This replaces unsafe as u16 truncating subtraction with a saturating variant that correctly returns zero instead of aborting on a unsigned underflow when the true result is a deep-underflow zero (IEEE 754-2019 §7.5, sq-25mgo).

src/lib.nr — adds three regression tests:

  • f128_mul_deep_underflow_returns_signed_zero — verifies sign-correct zero for smallest_subnormal² and cross-sign variants
  • f128_div_deep_underflow_returns_signed_zero — verifies sign-correct zero for min_sub / max_finite and cross-sign variants
  • f128_arithmetic_preserves_gradual_underflow_subnormals — anti-over-saturation guard: legitimate subnormals must not be flushed to zero

README.md — intentionally kept as standalone published-face content (in-tree README has old vendoring provenance text; standalone README is correct).

Test plan

  • nargo test --silence-warnings → 32/32 in-source tests pass (Nargo 1.0.0-beta.21)
  • Zero byte diff remaining between in-tree source .nr files and this repo after porting
  • CI workflow will run in-source tests + generated arithmetic vectors + public API surface checks

… drift (sq-ev2hm) [SONNET-4.6]

Ports all in-tree drift accumulated since the noir_IEEE754 repo was
transferred to sparq-org. The only source drift was sparq PR #1558
(fix(zk/ieee754): f128 mul/div flush deep-underflow to signed zero):

- src/ops/kernels.nr: add `saturating_biased_exponent` helper; apply
  saturating u32 underflow-safe exponent arithmetic in f128 mul, div, and
  narrow-format mul/div kernels (sq-25mgo fix).
- src/lib.nr: add three regression tests —
  `f128_mul_deep_underflow_returns_signed_zero`,
  `f128_div_deep_underflow_returns_signed_zero`,
  `f128_arithmetic_preserves_gradual_underflow_subnormals`.

README.md intentionally kept as-is (standalone published-face content is
correct; in-tree README has old vendoring provenance text).

Nargo 1.0.0-beta.21: 32/32 in-source tests pass (up from 29 at transfer).
Copilot AI review requested due to automatic review settings July 5, 2026 11:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jeswr
jeswr enabled auto-merge (squash) July 5, 2026 11:30
@jeswr
jeswr merged commit ce02374 into main Jul 5, 2026
7 checks passed
@jeswr
jeswr deleted the resync/sq-ev2hm branch July 5, 2026 11:31
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.

2 participants