gft encoder: pin round-half-to-even on exact ties (Refs #2161) - #2640
Merged
Conversation
`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
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
PR DashboardGenerated at: 2026-08-24 00:58:49 UTC
Summary
Seal Status
|
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.
if t > hf: mant += 1in_magaddsurvived the boundary operator. It is the round-half-to-even decision:With
>=the pair becomes round-half-up and the parity test on the next line is dead code. Measured, not predicted: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 < 0in_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