Repository navigation
ocp_mx.t27: a wrong decimal in the outlier comment, and E8M0 constants copied from e8m0.t27 #7310
Description
Two small findings in specs/numeric/ocp_mx.t27 (merged in #6828 at 322cc77). Neither changes a test result.
1. A wrong decimal in a comment (line 290)
// Inputs in units of 2^-12; entry 13 is the outlier (13517 / 4096 = 3.29999...).
13517 / 4096 is 3.300048828125, not 3.29999. The test values are right; only the comment is wrong. The worked block's text ("one outlier, 3.3") and every test assert integers, so nothing else moves. The fix: (13517 / 4096 = 3.300049, the nearest 2^-12 step to 3.3).
2. The E8M0 constants are copied, not imported
ocp_mx.t27:80-81 declares its own E8M0 constants:
const E8M0_BIAS : i64 = 127; // as in `e8m0.t27`
const E8M0_NAN : i64 = 255;
specs/numeric/e8m0.t27:52-53 already declares E8M0_BIAS : i32 = 127 and E8M0_NAN_CODE : u32 = 255. Those are module-private there (no pub), with different types and a different name for the NaN code. So ocp_mx cannot import them today, and it copies them with an "as in" comment. That is the hand-copied-constant shape this codebase records as a defect: if one file changes and the other does not, nothing notices.
Options:
- (a)
e8m0.t27makesE8M0_BIASandE8M0_NAN_CODEpub, andocp_mx.t27uses them. This needs theusepath to work forspecs/numeric(see 112 use lines name no spec: fix them before #7176 makes it an error #7191 onuselines that name no spec), plus a cast at the use site for the i32/u32 to i64 difference. - (b) Keep the copy but make it checked.
ocp_mxgets a test that pins the two values to Table 7 of OCP MX v1.0, ande8m0gets the same test. A change to one then fails a test that names the other.
(a) is the root fix. (b) is the stopgap if use across numeric specs is not ready.
🤖 Generated with Claude Code
Boundary
specs/numeric/e8m0.t27specs/numeric/ocp_mx.t27
User Scenarios
- Given
specs/numeric/ocp_mx.t27line 290 has a comment stating13517 / 4096 = 3.29999..., when the comment is corrected, then it reads13517 / 4096 = 3.300049, the nearest 2^-12 step to 3.3. - Given
specs/numeric/e8m0.t27declaresE8M0_BIAS : i32 = 127andE8M0_NAN_CODE : u32 = 255as module-private, andspecs/numeric/ocp_mx.t27copies them asE8M0_BIAS : i64 = 127andE8M0_NAN : i64 = 255, whene8m0.t27makes these constantspubandocp_mx.t27imports them with appropriate casts, then both files share a single source of truth for the E8M0 constants.
Requirements
- FR-001: The comment at
specs/numeric/ocp_mx.t27:290MUST state the correct decimal value3.300049(or3.300048828125) with an explanation that it is the nearest2^-12step to3.3. - FR-002:
specs/numeric/e8m0.t27MUST exportE8M0_BIASandE8M0_NAN_CODEaspubconstants so they can be imported by other specs. - FR-003:
specs/numeric/ocp_mx.t27MUST importE8M0_BIASandE8M0_NAN_CODEfrome8m0.t27using ausestatement and apply the necessary casts fromi32/u32toi64at the use site, removing the hand-copied constant declarations. - FR-004: The
usepath mechanism MUST work for importing fromspecs/numeric/e8m0.t27intospecs/numeric/ocp_mx.t27.
Success Criteria
t27c specs/numeric/ocp_mx.t27compiles without error andexit 0t27c specs/numeric/e8m0.t27compiles without error andexit 0- The comment at
specs/numeric/ocp_mx.t27:290contains3.300049(or3.300048828125) and no longer contains3.29999 specs/numeric/ocp_mx.t27contains no declaration ofE8M0_BIASorE8M0_NANconstants (they are imported frome8m0.t27)specs/numeric/e8m0.t27declarespub const E8M0_BIAS : i32 = 127andpub const E8M0_NAN_CODE : u32 = 255specs/numeric/ocp_mx.t27usesuse specs/numeric/e8m0.t27(or equivalent working path) and referencese8m0.E8M0_BIASande8m0.E8M0_NAN_CODEwith casts toi64
Activity
gHashTag commentedon Oct 7, 2026
Reopened 2026-10-07: the bulk close of issues without a
## Boundarysection was reverted by the owner. Nothing to do here; this comment replaces the earlier close notice.