Skip to content

t27b: a signed @mod of any width up to i64 widens to the i64 routine (arena_heap, file_io_contract, reel_particles_mux) #10423

Closed as not planned

Description

@gHashTag

Follow-up to #10405 / PR #10410, t27b coverage epic #6063.

Boundary

  • specs/tri/t27b/libm_plan.t27 (the decision) and its generated gen/rust/tri/t27b/libm_plan.rs (t27c gen-rust).
  • specs/tri/t27b/conformance/rem_int.t27 (conformance cases; no new file).
  • cli/t27b/src/lower.rs libm_call glue only, net <= 0 lines.
  • docs/reports/t27b_expectations.json rows and .trinity/seals/ for the specs that move.
  • Out of scope: a float @mod, a signed @mod wider than i64 (no i128 routine), any other builtin.

User Scenarios

  • A spec author writes @mod(n, 2) on an i32 (specs/ml/arena_heap.t27 is_pow2), @mod(size, 4) (specs/ml/file_io_contract.t27) or @mod(ms, 1000) (specs/t27f/reel_particles_mux.t27 millis). Today t27b refuses each file with ExprCall(@mod): "a signed @mod is ported for i64 only" (REFUSE_WIDTH). After this, t27b compiles them and gives the reference's verdict.

Requirements

  • A signed @mod narrower than i64 (i32, i16, i8, odd widths) lowers by widening both operands (the second takes the first one's type) to i64, calling the existing t27b_libm_mod, and narrowing the result back. This is lossless because the result is 0 <= r < b and b fits the operand type, and a zero or negative divisor traps or panics as before.
  • The choice (widen and narrow rather than one routine per width) is recorded in libm_plan.t27 with tests.
  • A signed @mod wider than i64 stays refused with REFUSE_WIDTH. An integer @rem of every width stays t27b's %.

Success Criteria

  1. t27b test --blockers no longer lists ExprCall(@mod) for specs/ml/arena_heap.t27, specs/ml/file_io_contract.t27 or specs/t27f/reel_particles_mux.t27.
  2. t27b test --check agrees with t27c test-report on rem_int.t27 and libm_plan.t27.
  3. The ledger rows in docs/reports/t27b_expectations.json are updated for any spec that moves to pass.
  4. Seals are re-saved, and the hand-written lower.rs is net <= 0 lines.

Requirements

FR-001: A signed @mod narrower than i64 (i32, i16, i8, odd widths) MUST widen both operands (the second operand takes the first operand's type) to i64, call the existing t27b_libm_mod, and narrow the result back to the original width.

FR-002: The widening-and-narrowing design choice MUST be recorded in specs/tri/t27b/libm_plan.t27 with accompanying tests.

FR-003: A signed @mod wider than i64 MUST continue to be refused with REFUSE_WIDTH.

FR-004: An integer @rem of every width MUST continue to lower to t27b's % operator.

Activity

  1. added a commit that references this issue on Oct 18, 2026
    ea87299
  2. added
    shape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it
    on Oct 18, 2026
  3. github-actions commented on Oct 18, 2026

    @github-actions
    Contributor

    Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.

    • missing: ## Requirements -- numbered obligations, FR-001: ... MUST ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    queen-shapedshape-refusedClosed by the issue-shape gate (specs/policy/issue_shape.t27); a passing edit reopens it

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions