lib: banner purge + WHY-only comment sweep (rule 8)
Every // ---- section banner dies (132 -> 0): names carry the WHAT. Narration deleted (filename restatements, run-with lines, what-the- next-line-does); every ref/hare cite, task cite, divergence, ABI/ layout contract, and ownership qualifier kept (borrowed-view lines restored where the sweep over-cut). Comment-only proven: all 442 walk-workdir .s and 32 import-probe .s byte-identical before/after; libbyteid 56-roster all-ID.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
// strconv — arbitrary-precision decimal engine for float↔string
|
||||
// conversion. Mirrors ref/hare/strconv/decimal.ha (Hare in turn ports
|
||||
// Go's lib/strconv/decimal.go). Pure integer arithmetic; no f32/f64
|
||||
// Mirrors ref/hare/strconv/decimal.ha (Hare in turn ports Go's
|
||||
// lib/strconv/decimal.go). Pure integer arithmetic; no f32/f64
|
||||
// references (#121 residual-guard SAFE).
|
||||
//
|
||||
// Spelling divergences from Hare (mechanical, ww-side parser shape):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// strconv — float→string via Ryū (shortest round-trippable decimal).
|
||||
// Mirrors ref/hare/strconv/ftos_ryu.ha (the algorithm core) +
|
||||
// ref/hare/strconv/ftos.ha:432 (the f64tos driver). Ryū: Ulf Adams,
|
||||
// https://doi.org/10.1145/3192366.3192369 — Hare translated it from the
|
||||
@@ -339,12 +338,12 @@ fn f64todecf64(mantissa: u64, exponent: u32) decf64 = {
|
||||
return decf64 { exponent = (exp: i64), mantissa = output };
|
||||
};
|
||||
|
||||
// ==== f32 Ryū sub-path (ftos_ryu.ha). The *32 helpers below mirror their
|
||||
// f32 Ryū sub-path (ftos_ryu.ha). The *32 helpers below mirror their
|
||||
// u64 siblings at 32-bit width; they reuse the SHARED f64computeinvpow5/
|
||||
// f64computepow5 (and thus the f64 SPLIT2 tables) per ftos_ryu.ha — there
|
||||
// is no separate f32 table. Same scalar-PARAM-mutation → copy-to-local,
|
||||
// comma-split, expr-yield → block divergences as the f64 path
|
||||
// above. ====
|
||||
// above.
|
||||
|
||||
// ref/hare/strconv/ftos_ryu.ha:52. Largest p with 5^p | value (32-bit).
|
||||
fn pow5fac32(v: u32) u32 = {
|
||||
@@ -523,13 +522,13 @@ fn f32todecf32(mantissa: u32, exponent: u32) decf32 = {
|
||||
return decf32 { mantissa = output, exponent = (exp: i64) };
|
||||
};
|
||||
|
||||
// ==== G-format encode layer (ftos.ha) — only the ffmt::G / prec=void /
|
||||
// G-format encode layer (ftos.ha) — only the ffmt::G / prec=void /
|
||||
// fflags::NONE-REACHABLE logic. The SHOW_POINT/precision/E-vs-uppercase
|
||||
// arms (ftos.ha:88-105, 127-145, 170-213's zeros/caps) are UNREACHABLE
|
||||
// for G/void/NONE (ffpoint(NONE)=false, prec is never uint, f is always
|
||||
// G) and are NOT ported — porting them stubbed would be untested dead
|
||||
// code. The parametric ftosf/ffmt/fflags surface is deferred (task #64;
|
||||
// needs a parametric consumer + io::handle + #158). ====
|
||||
// needs a parametric consumer + io::handle + #158).
|
||||
|
||||
// ref/hare/strconv/ftos.ha:49. Decimal digit-count of n (n <= 1e17).
|
||||
fn declen(n: u64) uint = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// strconv — Ryū float→string lookup tables + bit-count constants.
|
||||
// Mirrors ref/hare/strconv/ftos_ryu.ha:159-222 byte-exact. Pure data
|
||||
// fold (strconv #106 fold-5): no logic, consumed by ftos.ww's
|
||||
// f64computeinvpow5 / f64computepow5 (the Ryū power-of-five cores).
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// ftostest — exercises lib/strconv/ftos.ww (Hare ftos.ha / ftos_ryu.ha
|
||||
// Ryū port).
|
||||
//
|
||||
// Ports ref/hare/strconv/+test/ftos_test.ha's ffmt::G / prec=void /
|
||||
// fflags::NONE rows (the f64tos cases) verbatim — these are exactly
|
||||
// strconv.f64tos's output. encode_f_dec is covered by 13.37/1100/0.011/…
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// inttest — exercises lib/strconv integer parse: parseint / stoi64 /
|
||||
// stou64 / the iN/uN width wrappers.
|
||||
//
|
||||
// Verbatim port of ref/hare/strconv/stoi.ha:56-86 (stoi/stoi_bases) and
|
||||
// stou.ha:116-138 (stou/stou_bases). Hare's strconv integer tests are
|
||||
// flat assert SEQUENCES, not row-array tables — mirrored here as inline
|
||||
@@ -210,7 +207,6 @@ fn ck_uint_ovf(id: i32, s: str, b: base) void = {
|
||||
ck_uint(62, "110101", base.BIN, 53u64: uint); // 0b110101
|
||||
};
|
||||
|
||||
// ---- format side: u64tos / i64tos / machine-word wrappers ------------
|
||||
// Verbatim ports of ref/hare/strconv/utos.ha:74-103 (utos/utos_bases) and
|
||||
// itos.ha:54-87 (itos/itos_bases) — Hare's format tests are flat assert
|
||||
// sequences too. Radix-literal inputs are written in DECIMAL (ww value
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// strconv — string-to-float. Mirrors ref/hare/strconv/stof.ha
|
||||
// (Hare in turn adapts Go): Eisel-Lemire fast path [1] with the
|
||||
// Simple-Decimal-Conversion slow path [2] (decimal.ww) as fallback.
|
||||
// Mirrors ref/hare/strconv/stof.ha (Hare in turn adapts Go):
|
||||
// Eisel-Lemire fast path [1] with the Simple-Decimal-Conversion slow
|
||||
// path [2] (decimal.ww) as fallback.
|
||||
// [1]: https://nigeltao.github.io/blog/2020/eisel-lemire.html
|
||||
// [2]: https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html
|
||||
//
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// strconv — stof/ftos lookup tables. Mirrors ref/hare/strconv/stof_data.ha
|
||||
// byte-exact. Pure-data fold (strconv #106 fold-2, was fold-3 before drew
|
||||
// Mirrors ref/hare/strconv/stof_data.ha byte-exact. Pure-data fold (strconv #106 fold-2, was fold-3 before drew
|
||||
// re-sequenced 2026-05-26): no logic, exercised transitively when fold-3's
|
||||
// `leftshift_newdigits` lands (ref/hare/strconv/decimal.ha:35).
|
||||
//
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// stoftest — exercises lib/strconv/stof.ww (Hare stof.ha port).
|
||||
//
|
||||
// Ports ref/hare/strconv/stof.ha's @test vectors (stof64 / stof32 /
|
||||
// stofhex). Comparisons are BIT-level (math.f64bits / f32bits) so a
|
||||
// sign flip (-0.0 vs 0.0) or a 1-ulp miss fails the row rather than
|
||||
@@ -14,8 +12,6 @@ import strconv;
|
||||
import math;
|
||||
|
||||
|
||||
// ---- unwrap helpers (bit-exact value checks) -------------------------
|
||||
|
||||
fn chk64(s: str, b: base, want: f64) bool = {
|
||||
match (stof64(s, b)) {
|
||||
case let v: f64 => { return math.f64bits(v) == math.f64bits(want); };
|
||||
@@ -89,7 +85,6 @@ fn nan32(s: str) bool = {
|
||||
return false;
|
||||
};
|
||||
|
||||
// ---- stof64 ----------------------------------------------------------
|
||||
// ref/hare/strconv/stof.ha:530.
|
||||
|
||||
@test fn stof64_dec() void = {
|
||||
@@ -141,7 +136,6 @@ fn nan32(s: str) bool = {
|
||||
assert(!(!nan64("naN")));
|
||||
};
|
||||
|
||||
// ---- stof32 ----------------------------------------------------------
|
||||
// ref/hare/strconv/stof.ha:560.
|
||||
|
||||
@test fn stof32_dec() void = {
|
||||
@@ -180,7 +174,6 @@ fn nan32(s: str) bool = {
|
||||
assert(!(!chk32("9.19100241453305036800e+20", base.DEC, 9.19100241453305036800e+20f32)));
|
||||
};
|
||||
|
||||
// ---- stofhex ---------------------------------------------------------
|
||||
// ref/hare/strconv/stof.ha:590. Hex-float surface-form literals (0x1.fp-2,
|
||||
// math::F64_MAX_NORMAL, …) are spelled as IEEE-754 bit patterns since ww
|
||||
// has no hex-float literal lexer / no F*_MAX_NORMAL math consts.
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// strconv — number↔string conversions.
|
||||
//
|
||||
// Mirrors Hare's strconv:: surface. The *tos functions return a
|
||||
// `const str` view into a module-level buffer that is overwritten on
|
||||
// the next call to the same function; callers must copy the bytes if
|
||||
@@ -71,7 +69,7 @@ let lut_lower: [16]rune = [
|
||||
// fidelity; the initial value is irrelevant (only the freshly-written
|
||||
// prefix is ever read) but the fill form is exercised (probed: emits
|
||||
// byte-identically cross-stage).
|
||||
let u64tos_buf: [64]u8 = [0...]; // 64 binary digits
|
||||
let u64tos_buf: [64]u8 = [0...];
|
||||
|
||||
// u64tos — convert u to a base-b numeric string. Returns a view into
|
||||
// `u64tos_buf`, overwritten on the next call; copy via strings.dup to
|
||||
@@ -114,7 +112,7 @@ export fn u64tos(u: u64, b: base) str = {
|
||||
// i64tos_buf — independent from u64tos_buf so i64tos's own u64tos call
|
||||
// (the magnitude) doesn't clobber the in-flight result. 65 = 64 digits
|
||||
// plus the leading '-'. Hare's `static let buf: [65]u8` (itos.ha:18).
|
||||
let i64tos_buf: [65]u8 = [0...]; // 64 binary digits plus '-'
|
||||
let i64tos_buf: [65]u8 = [0...];
|
||||
|
||||
// i64tos — convert i to a base-b numeric string. Returns a view into
|
||||
// `i64tos_buf`. Verbatim port of ref/hare/strconv/itos.ha:10-32.
|
||||
|
||||
Reference in New Issue
Block a user