Skip to content

gft encoder: pin round-half-to-even on exact ties (Refs #2161) - #2640

Merged
gHashTag merged 2 commits into
masterfrom
fix/round-half-to-even
Aug 24, 2026
Merged

gft encoder: pin round-half-to-even on exact ties (Refs #2161)#2640
gHashTag merged 2 commits into
masterfrom
fix/round-half-to-even

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

if t > hf: mant += 1 in _magadd survived the boundary operator. It is the round-half-to-even decision:

if t > hf: mant += 1                  # strictly above half
elif t == hf and (s & 1): mant += 1   # exactly half -> to even

With >= the pair becomes round-half-up and the parity test on the next line is dead code. Measured, not predicted:

_magadd(25600, 20480)   clean 25600    mutated 25601
_magadd(20992, 20481)   clean 21248    mutated 21249
_magadd(21504, 20482)   clean 21632    mutated 21633

256 such witnesses exist, and the self-tests notice none of them.

Why an outcome test could not see it

The self-tests train a network and assert on accuracy. An optimiser absorbs a last-bit error in every addition without changing whether XOR reaches 4/4 — planted, the mutant passes every training assertion in the file.

A test that checks an outcome cannot see a defect the outcome tolerates. Accuracy, throughput, "it still converges" — each is a real property, and each is a filter that removes exactly the errors an adaptive process routes around. Arithmetic needs assertions on arithmetic.

Three assertions now pin the decision, one per branch. Negative controls: weakening > to >= fails the even-tie assertion; disabling the parity test fails the odd-tie one. Each control hits the assertion aimed at it, which is what makes them three tests rather than one repeated.

Column: 6/31 → 7/31.

And a correction

This tick was planned around microcode:203 (if d < 0 in _magsub), carried from yesterday's classification table. It is not a survivor — with <= the XOR self-test reports 1/4 and the mutant dies loudly.

I had found it by grep, classified it as a real boundary, then silently promoted "real boundary" to "surviving boundary". Those are different claims: one is about the code, the other about what the tests reach.

§70 is mine — a finding recorded as a line number expires. This is worse: it never was a finding, and the line number gave it enough shape to look like one. The tick recovered only because the first thing I did was reproduce the survivor rather than fix it.

§112 and §113.

Refs #2161

`if t > hf: mant += 1` in _magadd survived the boundary operator. It is
the round-half-to-even decision:

    if t > hf: mant += 1                  strictly above half
    elif t == hf and (s & 1): mant += 1   exactly half -> to even

With `>=` the pair becomes round-half-UP and the parity test on the
next line is dead code. Measured:

    _magadd(25600, 20480)  clean 25600   mutated 25601
    _magadd(20992, 20481)  clean 21248   mutated 21249
    _magadd(21504, 20482)  clean 21632   mutated 21633

256 such witnesses exist. The self-tests did not notice ANY of them,
because they train a net and check ACCURACY: an optimiser absorbs a
last-bit error in every addition without changing whether XOR reaches
4/4. An outcome test cannot see an arithmetic defect that outcomes
tolerate.

Three assertions pin the decision itself, one per branch: a tie with
even `s` must NOT round up, a tie with odd `s` must, and strictly above
half must. Negative controls: weakening `>` to `>=` fails the first,
disabling the parity test fails the second.

A correction, too. I planned this tick around line 203, `if d < 0` in
_magsub, listed yesterday among four boundary sites -- without checking
it was a survivor. It is killed: with `<=` the XOR self-test reports
1/4. A finding recorded as a line number expires on the next edit, and
that rule is one I wrote.

Refs #2161
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-24 00:58:49 UTC

Summary

Status Count
Total Open PRs 2
PRs with Failing Checks 1
PRs with All Checks Green 1
READY 0
FAILING 1
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=e6333575ec10 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit e8fe74e into master Aug 24, 2026
27 of 28 checks passed
@gHashTag
gHashTag deleted the fix/round-half-to-even branch August 24, 2026 01:07
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.

1 participant