fix(run): fidelity readout never rounds a near-unity F to a bare 1 - #96
Merged
Merged
Conversation
formatFidelity's toFixed(4) collapsed any F ≥ 0.99995 to "1" in the run chip, ring-2 Run hero, and Run modal — hiding exactly the number that matters. Precision now extends a digit at a time (cap 10) until the gap from 1 (or 0) survives rounding; ordinary values keep the 4-decimal form and only a true 1 renders bare. 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
formatFidelity(problem.ts) rendered withtoFixed(4), so anyHow
Adaptive precision in the one shared formatter: ordinary values keep the 4-decimal form (existing renders unchanged —
F=0.9998 · 60 iter,solving… F=0.968), but when rounding would collapse the value to exactly 1 or 0, precision extends one digit at a time (capped at 10) until the gap survives. Only a true 1/0 renders bare. The gap from perfect is the result; the display must never erase it.Applies automatically to every consumer of
runChipText/runVerdict— chip, hero, modal.Verification
bun test src/amicode/problem.test.ts: 34 pass, including new near-unity cases (0.99997 →F=0.99997, 0.99999997 →F=0.99999997, solving f=3e-5 →F=0.99997, true 1 →F=1)npm run lint: 0 errors;tsgo -bin packages/app: clean🤖 Generated with Claude Code