Skip to content

t27b: f64 floor/ceil, i64 mod and log of a literal -- token_floor blockers 11 -> 4 (Closes #10405) - #10410

Merged
gHashTag merged 2 commits into
masterfrom
t27b-token-floor-libm
Oct 18, 2026
Merged

gHashTag merged 2 commits into
masterfrom
t27b-token-floor-libm

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #10405

Clears the three smallest t27b blockers on specs/t27f/token_floor.t27. The routines are written in .t27 and the plan is generated.

blocker sites what t27b does now
f64 @floor / @ceil 5 (226, 230, 547, 1130, 1131) calls t27b_libm_floor / t27b_libm_ceil in specs/tri/t27b/libm.t27. These are ports of compiler_rt floor/ceil, bit-exact against Zig's @floor/@ceil (roundsd on the lab), signed zeros and NaN quieting included.
@mod 1 (lcg in specs/t27f/reel_particles.t27) an i64 calls t27b_libm_mod: the floored remainder, with Zig's Debug panic on a non-positive divisor. An unsigned @mod is %. A signed @mod of another width is refused with a named reason.
@log of a literal 1 (@log(10.0), line 220) calls the f64 routine on the literal rounded once to f64. Zig folds a comptime_float through compiler_rt logq, which is log of the f64 cast. log_of_a_literal_is_the_f64_routine_s checks the folded value against the exact decimal of the f64 result, and the reference passes it; an f128-precise fold would fail it.

The decision lives in specs/tri/t27b/libm_plan.t27, which is regenerated to gen/rust/tri/t27b/libm_plan.rs. New plan values: MOD, K_UINT, K_I64, CALL_I64, REFUSE_WIDTH. cli/t27b/src/lower.rs changes by +5/-5 lines, net 0: the first operand's type (ty0) replaces the f32/f64 switch, and a float literal is coerced instead of refused. The conformance cases went into existing specs, conformance/libm_rounding.t27 (f64 sweeps over every exponent of both signs) and conformance/rem_int.t27 (@mod cases plus lcg as written). No new conformance file was added. Seals were re-saved for the four changed specs, and for the three that hold libm.t27 in their closure.

Lab evidence (t27c lab, t27b built for aarch64, run under qemu-aarch64)

t27b test --blockers specs/t27f/token_floor.t27, before (master 8ea4720): 11

type [N]T at line 735 (`[*:0]const u8` ...)
type [N]T at line 766 (`[*:0]const u8` ...)
ExprCall(@log) at line 220 (the operand is a literal ...)
ExprCall(@floor) at line 226 (libm.t27 has no f64 routine for it)
ExprCall(@floor) at line 230 (libm.t27 has no f64 routine for it)
ExprCall(@ceil) at line 547 (libm.t27 has no f64 routine for it)
ExprCall(std.*) at line 767 (call to `std.c.getenv`)
ExprCall(@floor) at line 1130 (libm.t27 has no f64 routine for it)
ExprCall(@ceil) at line 1131 (libm.t27 has no f64 routine for it)
ExprCall(std.*) at line 1187 (call to `std.debug.print`)
ExprCall(@mod) at line 2049 (call to `@mod`)

After (this branch): 4. All four are scoped in their own issues:

type [N]T at line 735 (`[*:0]const u8`: length `*:0` is not a compile-time integer)   -> #10408
type [N]T at line 766 (`[*:0]const u8`: length `*:0` is not a compile-time integer)   -> #10408
ExprCall(std.*) at line 767 (call to `std.c.getenv`)                                  -> #10408
ExprCall(std.*) at line 1187 (call to `std.debug.print`)                              -> #10409

t27b test --check and t27c test-report agree on every changed spec:

spec t27c test-report t27b test --check
specs/tri/t27b/libm.t27 30 pass 30 pass, 3 invariants held
specs/tri/t27b/libm_plan.t27 16 pass 16 pass
specs/tri/t27b/conformance/libm_rounding.t27 8 pass 8 pass
specs/tri/t27b/conformance/rem_int.t27 6 pass 6 pass

Ratchet, scoped to the 28 specs that use @mod, @floor, @ceil or @log:

  • Every ledger row among them holds. The 10 pass rows still pass.
  • The 3 blocked rows keep their blocker construct: arena_heap and file_io_contract are still ExprCall(@mod), because their @mod is a signed non-i64 one, and gradient is still ExprCall(@exp).
  • No ledger edit is needed.

The full corpus ratchet is this PR's t27b-native-ratchet check, run natively on ubuntu-24.04-arm.

Timing: none is reported. t27b emits AArch64 only, and the lab is x86_64 running t27b under qemu-aarch64, so no wall-time comparison with native zig is fair there. No qemu time here is a speed result.

Follow-ups (not in this PR)

🤖 Generated with Claude Code

gHashTag and others added 2 commits October 18, 2026 18:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lan regenerated, seals re-saved (Closes #10405)

token_floor.t27 blockers 11 -> 4 on the t27c lab. The four left are the
shard env reader (#10408) and the frame writer (#10409).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) October 18, 2026 11:16
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 11:16:27 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 50
PRs with All Checks Green 0
READY 0
FAILING 50
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fad12492937a != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 03c6be1 into master Oct 18, 2026
33 of 41 checks passed
gHashTag added a commit that referenced this pull request Oct 18, 2026
…r widths ledgered, rem arity text, former_name spelling (Closes #10439, Closes #10440, Closes #10441) (#10443)

- Verilog widths: token_floor.t27 emits [8388607:0] (rsp, the row index,
  524288*16 bits) and [49766399:0] (bgq, the empty 1080x1920x3 frame). Both
  are exact working buffers of a host-side renderer; ledgered with the
  arithmetic like big_frame and suggest_feed.
- t27b tail: the @Rem arity case expects "`@rem` and `@mod` two", the text
  #10410 gave the refusal.
- count-invariant: the nine tnf rows carry former_name="GF-TN (historical)"
  since #6953 (deliberate: it removed a name=/former_name= alias); the
  invariant, its planted tree and its negative control now expect that.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27b: f64 floor/ceil, mod and log of a literal for specs/t27f/token_floor.t27

1 participant