Grade expression_in_range against its oracle in Rust (#227) - #357
Merged
Conversation
wormeyman
force-pushed
the
feat/227-expression-in-range-oracle
branch
from
August 30, 2026 06:06
0650f78 to
eaff426
Compare
First of the cheap-tier delete-with-loss ports. `tiles/expression_in_range.rs` has six tests and all six assert shape on hand-written inputs, so nothing on this side ever read `oracle-expression-in-range.seed123456.json`. Deleting `test/expressionInRange.spec.ts` with the rest would have left that fixture committed, version-pinned, and graded by nothing. The gap is not theoretical. Planting the pre-f32 f64 arithmetic in the builtin itself - which is the exact defect this fixture was captured to catch - leaves **all six existing tests green**, and only the three sweeps added here fail. Five tests, from the spec being retired: - the bounded 1-D sweep, `expression_in_range(20, 1, (x/1000), -0.5, 0.5)` - the unbounded 1-D sweep, which also pins that an infinite maximum does NOT clamp: in-range values run past 1, peaking near 2.5, and a clamp would silently kill sand-1's coastal boost - the 2-D sweep, which pins that dimensions combine by min rather than by product or sum - the f64 arithmetic rejected against the same fixture, so the three above cannot be recording whatever the implementation happens to do - sand-1's asymmetric, unbounded shape against the hand-derived formula All three sweeps are EXACT - every position of 121, 121 and 162. That matters because the assertion these replaced started life as a `toBeLessThan(8e-3)` ceiling which the wrong implementation passed comfortably; the real residual is about 9.5e-7, so the ceiling was some 8400x too loose. Two deliberate departures from the spec: - The f64-rejection count is frozen at 34 of 121 rather than the spec's "more than 10". A number that moves is a finding. - The sand-1 case keeps a 1e-6 tolerance rather than tightening it. The builtin rounds every step to f32 and intermediates like `1 - 1.2` are not representable there, so -1.0 comes back as -1.000000238418579. Asserting the exact f32 result would mean recomputing the function inside the test and checking it against itself. Bit-exactness is the three sweeps. One thing worth knowing for the deletion: the fixture stores the unbounded sweep's maximum as the STRING "inf", so it cannot be read as a number. Claude-Session: https://claude.ai/code/session_01UVcbv1pAhPUoCC6aBwZUtg Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
wormeyman
force-pushed
the
feat/227-expression-in-range-oracle
branch
from
August 30, 2026 06:31
eaff426 to
9be54d9
Compare
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.
First of the cheap-tier delete-with-loss ports.
tiles/expression_in_range.rshas six tests and all six assert shape on hand-written inputs, so nothing on
this side ever read
oracle-expression-in-range.seed123456.json. Deletingtest/expressionInRange.spec.tswith the rest would have left that fixturecommitted, version-pinned, and graded by nothing.
The gap is not theoretical. Planting the pre-f32 f64 arithmetic in the builtin
itself - which is the exact defect this fixture was captured to catch - leaves
all six existing tests green, and only the three sweeps added here fail.
Five tests, from the spec being retired:
expression_in_range(20, 1, (x/1000), -0.5, 0.5)clamp: in-range values run past 1, peaking near 2.5, and a clamp would
silently kill sand-1's coastal boost
product or sum
cannot be recording whatever the implementation happens to do
All three sweeps are EXACT - every position of 121, 121 and 162. That matters
because the assertion these replaced started life as a
toBeLessThan(8e-3)ceiling which the wrong implementation passed comfortably; the real residual is
about 9.5e-7, so the ceiling was some 8400x too loose.
Two deliberate departures from the spec:
than 10". A number that moves is a finding.
rounds every step to f32 and intermediates like
1 - 1.2are notrepresentable there, so -1.0 comes back as -1.000000238418579. Asserting the
exact f32 result would mean recomputing the function inside the test and
checking it against itself. Bit-exactness is the three sweeps.
One thing worth knowing for the deletion: the fixture stores the unbounded
sweep's maximum as the STRING "inf", so it cannot be read as a number.
Claude-Session: https://claude.ai/code/session_01UVcbv1pAhPUoCC6aBwZUtg
Co-authored-by: Claude Opus 5 (1M context) noreply@anthropic.com