SM/REM as written in section 4 never returned correctly for a negative dividend. It holds three entries on the return stack and then calls DABS -> DNEGATE -> D+ -> U> -> SWAP/U<, which overflows the 9-deep circular return stack (D-2). DABS itself could not run: DNEGATE as written (inv SWAP inv SWAP 1 0 D+) left its caller no return entries. - DNEGATE: inv over if L1 drop push inv 1 + pop ; L1: drop 1 + ; i.e. ~d + 1, carrying into the high cell exactly when lo = 0. - SM/REM: sign tests are native -if (as in 0<) and NEGATE is in line; the only calls are DNEGATE and UM/MOD, both call-free inside. Executed on the golden model at 32- and 64-bit cells, optimised and under ASan+UBSan: - SM/REM on dividends built as q*n + r with |r| < |n| and r signed as d: every edge-vector q, n with r = 0 and r = +-(|n|-1), plus 20000 pseudo-random cases. - /MOD, U>, ABS, S>D, D+ and DABS as written in section 5, against C (D+ over all 50625 edge-vector quadruples). Mutations of DNEGATE's carry and of each SM/REM sign branch are caught. Headroom (data cells under args / return entries under return address): SM/REM 5/3, /MOD 5/2, DNEGATE 7/7, DABS 7/6, ABS 8/7, U> 6/5. D+ as written is exact but leaves only 1 return entry; recorded in DECOMPOSITION.md 5.7 as not yet revised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v4/
StarForth v4: the 32-instruction F18-derived core. The design lives in
docs/v4.0.0/JUSTIFICATION.md (why) and docs/v4.0.0/DECOMPOSITION.md
(every v3 word mapped to a v4 fate).
The first deliverable is the hosted C99 golden model (JUSTIFICATION.md §10,
step 1). It must pass POST and hold K≡1.0 with 32- and 64-bit cells on all
three host ISAs.
What exists so far is the single node: registers, circular stacks, memory, all
32 opcodes, and per-opcode and per-call-target heat. make -C v4 test builds
and runs the tests at both cell widths; make -C v4 sanitize repeats them
under ASan and UBSan. There is no compiler capsule, no POST and no K
measurement yet.