Repository navigation
t27b: std.math.inf, std.math.log with base e, std.math.log1p and an f64 @round, from libm_plan.t27 (Closes #7923) - #7925
Merged
Merged
Conversation
@round, from libm_plan.t27 (Closes #7923) Part of #6063 (t27b coverage), item C10 of #6488. - libm_plan.t27: std.math.inf names its type as nan does; std.math.log(T, base, x) takes the value third, calls `log` when the base is std.math.e (std/math/log.zig returns @log(x) there) and refuses by name another base or a type that is not the value's; std.math.log1p of an f64 and @round of an f64 get their routines. - libm.t27: inf / inff, compiler_rt `round` and std/math/log1p.zig's `log1p_64`, step for step. Under the reference they agree bit for bit with @round on 72000 points and with std.math.log1p on 124800. - conformance/libm_std_math.t27: weber_tuning's and formats' shapes, 4 tests, reference 4/4, 0 vacuous. - weber_tuning.t27 passes 12/12; formats.t27 moves to ExprArrayLiteral. - Glue: lower.rs +6 -3, tests/tail.rs +18 -2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AGENTS.md keeps #7803's line and re-measures this PR's after it (wc -l); the ledger's counts are recounted from its rows: 925 / 151 / 34. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
Merged
Contributor
This was referenced Oct 8, 2026
This was referenced Oct 8, 2026
Contributor
PR DashboardGenerated at: 2026-10-08 22:19:31 UTC
Summary
Seal Status
|
The ledger keeps master's rows and this PR's; its counts are recounted from its rows: 944 / 140 / 32. No t27b source changed on master, so AGENTS.md's line stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
PR DashboardGenerated at: 2026-10-09 09:38:06 UTC
Summary
Seal Status
|
This was referenced Oct 9, 2026
The ledger takes master's rows and this PR's three; AGENTS.md is re-measured with wc -l on the merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
PR DashboardGenerated at: 2026-10-09 10:04:22 UTC
Summary
Seal Status
|
This was referenced Oct 9, 2026
Contributor
PR DashboardGenerated at: 2026-10-09 10:41:51 UTC
Summary
Seal Status
|
This was referenced Oct 9, 2026
gHashTag
pushed a commit
that referenced
this pull request
Oct 9, 2026
AGENTS.md takes master's and adds this branch's step: 15279 plus 1239 and 8264, on master a97cb9e's 15276 plus 1239 and 8247. The ledger takes master's and re-applies this branch's rows; max_not_pass recomputed from the entries: 24. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
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.
Closes #7923. Part of #6063 (t27b coverage), item C10 of #6488. Builds on #7819's
libm_plan.t27.Decision
specs/port/trinity/src/brain/weber_tuning.t27(reference 12/12) stopped atstd.math.log(f64, std.math.e, abs_v + 1.0)andstd.math.log1p(@abs(magnitude)); its f64@roundsat behind them.specs/numeric/formats.t27stopped atstd.math.inf(f32)(6 sites). All of these become calls of t27 routines, as@exp,@logandstd.math.nanalready are:std.math.inf(T)names its type, asnandoes. Its routine is +inf by its bits (0x7FF0000000000000, 0x7F800000).std.math.log(T, base, x)is@log(x)in Zig 0.16 when the base isstd.math.e(std/math/log.zig). So it callslog, which libm.t27 already holds.log2,log10or a quotient) is refused by name asREFUSE_BASE.REFUSE_TYPE.logf, which master gained in t27b: @log, @log2 and @log10 of an f32 call t27 ports of compiler_rt (Closes #7822) #7918 (see t27b: f32 @log, @log2 and @log10 from libm.t27 (compiler_rt logf, log2f, log10f) #7822).std.math.log1pof an f64 calls std/math/log1p.zig'slog1p_64(musl's log1p.c), ported step for step. An f32 is refused asREFUSE_NO_F32, becauselog1p_32is a different routine and is not ported.@roundof an f64 calls compiler_rt'sround, ported step for step.@floor,@ceil,@trunc,@rem,@log2and@log10of an f64 stay refused.has_f32andREFUSE_NO_ROUTINE, and gave@log2and@log10codes 11 and 12. This PR sits on top of that:std.math.inf,std.math.log1pandstd.math.logare codes 13 to 15;has_f32is back, false only forlog1p;REFUSE_BASE,REFUSE_TYPEandREFUSE_NO_F32are 6, 7 and 8.libm_call) reads the value operand where the plan says (operand) and passes only the operands after it. It asks the plan (with_base) aboutstd.math.log's base, which must be thestd.math.ethatstd_math_constalready recognizes, and about its type.formats.t27 now stops at
ExprArrayLiteral(line 628): a typed list that gen-zig prints as a tuple and indexes inside an invariant. That is tuple work and is not in this PR.Evidence
Reference:
t27c test-reporton the t27c lab, zig 0.16.0. t27b: aarch64 under qemu, built from the final head (this PR merged with master 19e0971).specs/port/trinity/src/brain/weber_tuning.t27ExprCall(std.*)specs/numeric/formats.t27ExprCall(std.*)ExprArrayLiteral(see #7930)specs/tri/t27b/conformance/libm_std_math.t27(new)specs/tri/t27b/libm.t27specs/tri/t27b/libm_plan.t27conformance/libm_logf.t27,libm_rounding.t27,bit_cast.t27The ports, against the reference. The conformance spec's sweeps hold libm.t27's
roundandlog1p(brought in byuse tri::t27b::libm;) bit for bit to Zig's@roundandstd.math.log1pof a run-time f64. Both give 0 differences:round: 72000 points over [-1000, 1000], around +-0.5 and near 2^52;log1p: 120000 points over (-1, 11100), plus 4800 from 5e-324 up by a factor of 1.37, both signs.libm.t27 keeps the fixed-value tests (-0, +-inf, NaN, -1, x < -1, ties). The sweeps sit in the conformance spec so that libm.t27's interpreter check keeps its fuel.
The conformance spec's expected values were printed by Zig 0.16 on the t27c lab, including an f32
std.math.log(logf). log(3.0) and log1p(2.0) differ in the last bit, so swapping the two routines fails it.Mutants, on the final specs:
useresolves), 41 of 41 in the plan's new tests, and 20 of 20 in libm.t27's new tests.operand(LOG_E)as 0 failslog_base_e_log1p_inf_and_an_f64_round(measured before the merge).ln2_hi(also measured before the merge).cargo test --release -p t27b(aarch64, qemu): 14 suites, exit 0.tests/tail.rs:@roundto be refused; it now names@flooras the first f64 refusal.log1p.Seals:
libm_plan.t27,libm.t27andconformance/libm_std_math.t27verified on the final head (all hashes MATCH).Policy gates: master's
check_budget()andcheck_all()(with master'sforeign-exceptions.txt) exit 0.Ledger: weber_tuning moves from blocked to pass, formats' blocker becomes
ExprArrayLiteral, and the new conformance row is a pass.Lines by file
On the final head, against master:
cli/t27b/src/lower.rscli/t27b/tests/tail.rsgen/rust/tri/t27b/libm_plan.rst27c gen-rust)specs/tri/t27b/libm_plan.t27specs/tri/t27b/libm.t27specs/tri/t27b/conformance/libm_std_math.t27.trinity/seals/*(3),docs/reports/t27b_expectations.json,AGENTS.mdHand-written lines: 29 added in total (owner rule #7371: 40 per file, 80 per PR).
Receipt
Base 430c522 (master, the lab's own signed run). Head ac1c2b7, this PR's change merged with that base, requested from the t27b lab with a fresh challenge (#7686). The compare was run on t27b-lab from
/work/t27as/work/t27c-master corpus-receipt compare BASE HEAD --challenge-head <challenge>:Exit 3, IMPROVED_ONLY.
gen_cross_entropy,gen_sigmoid,gen_softmax,bit_cast,libm_rounding), and the two libm specs. Each has the same verdict.ExprArrayLiteral(see t27b: a list literal indexed inside an invariant is a comptime tuple in the reference (ternary_gates.t27, formats.t27) #7930).cargo test --release -p t27b(aarch64, qemu)Commits after ac1c2b7.
wc -l) and the ledger. The ledger keeps master's rows and this PR's. Since fix(t27b): the ledger stores no total over its entries -- counts are derived, as steward.t27 decides (Closes #7859) #7862 (see t27b ledger: counts are derived from entries, not stored -- every spec PR conflicted on the pass line #7859) it stores no counts, onlymax_not_pass, 27 now.libm_plan.t27. It was resolved on this branch from another session, and this session took it as it stands (no force push). It is the one change after the receipt that is not a plain merge:std.math.inf,log1pandlogsit on top of master's plan as codes 13 to 15;has_f32is back, false only forlog1p(REFUSE_NO_F32);std.math.lognow callslogf;roundandlog1psweeps moved from libm.t27 to the conformance spec;On the final tree, on the t27c lab:
cargo test --release -p t27bpasses (14 suites);Native arm64 (
t27b-native-ratchet): reference disagree 0. No line names a file of this PR.Generated with Claude Code