ww/lex: fold float literals through strconv.stof64 — 1-ULP cs≠ww class (#62)

wwstage's parsef64 (naive i64-accumulator + pow-10 fold) diverged from
cstage's strtod: >19-digit mantissas overflowed the accumulator (sign-bit
garbage), DBL_MIN was +1 ULP, DBL_MAX -2 ULP — the #59.10 ratchet pin.
C-strtod oracle confirms cstage correctly rounded on every vector, so
wwstage aligns to it by dogfooding strconv.stof64 (correctly-rounded
decimal engine, already imported by lex.ww). Overflow literals now
reject in both stages (stof64 overflow -> errat, mirroring ERANGE).

Fix + #59.10 M_DIVERGE->M_ID graduation + pins land together per the
ratchet's designed flow (the gate trips loud demanding graduation):
oracle-pinned vectors in toktest.ww floatfold_cases (lexer-unit) and
989_floatlit_run (compiler fold: runtime bits + byte-id + overflow
reject parity). Retained subnormal accept-set asymmetry filed as task
#21, documented at the lexnum site.
This commit is contained in:
2026-06-04 23:12:00 +09:00
parent 74767c70cc
commit 60e61315bc
7 changed files with 340 additions and 233 deletions

View File

@@ -82,6 +82,10 @@ static const struct ent ents[] = {
{ .fixture = "lib/regex/regex_test.ww", .mode = M_ID },
{ .fixture = "lib/strconv/test/decimaltest.ww", .mode = M_ID },
{ .fixture = "lib/strconv/test/ftostest.ww", .mode = M_ID },
/* graduated from #59.10 DIVERGE by the #62 float-literal fold fix
* (wwstage lexer now folds through strconv.stof64, matching
* cstage's strtod bit-for-bit) */
{ .fixture = "lib/strconv/test/stoftest.ww", .mode = M_ID },
{ .fixture = "lib/strconv/test/inttest.ww", .mode = M_ID },
{ .fixture = "lib/strings/stringstest.ww", .mode = M_ID },
{ .fixture = "lib/temp/temptest.ww", .mode = M_ID },
@@ -125,8 +129,7 @@ static const struct ent ents[] = {
.mode = M_DIVERGE, .cite = "#59.8" },
{ .fixture = "lib/os/stattest.ww",
.mode = M_DIVERGE, .cite = "#59.9" },
{ .fixture = "lib/strconv/test/stoftest.ww",
.mode = M_DIVERGE, .cite = "#59.10" },
/* #59.10 stoftest graduated to M_ID above (#62 fix) */
{ .fixture = "lib/ww/lex/toktest.ww",
.mode = M_DIVERGE, .cite = "#59.11" },
/* asttest resolves `import tok` via -I lib/ww/lex, cf 905 */