feat(v4): v3's whole POST, Task 8 round -- the rules, and v4 where the rulings put it (#189)
v3's whole POST on v4 at 983 of 1010 (the table's own count with its drops), from 850.
What remains is capacity ("Dictionary full", the 100-900-deep stacks): next, as ruled.
Found and fixed under the rulings (docs/v4.0.0/POST-PARITY.md):
- IS and DEFER@ refuse a word DEFER did not make, as v3: error 22, "Not deferred".
v4's IS stored into any word -- POST's `42 IS DUP` broke DUP for every case after it.
DEFER marks its word with flag 128 (dict.f18).
- SMUDGE and HIDDEN are compile-only, as v3's table: at the prompt v4's hid the newest word.
- Q./ by zero gives 0 and no error (ruled: v3's table); error 11 retired. The ROM's,
the test's reference and its hand-assembled copy changed alike.
- FENCE is v3's: it protects what is defined so far. The variable is (FENCE).
- The line's length is (#SRC), no longer SPAN: an EXPECT in a line cut the rest of
the line off, and 0 EXPECT could not leave SPAN 0 (FORTH-83).
- POST gains V4_POST_HEAD: the values left and how the output begins -- the form of a
printout whose values are the run's own (TOP-WORDS, WORD-ENTROPY).
post_all_rules.py: the rest of the whole table where it is not taken as v3 ran it --
v4's units for the cases that wrote through HERE as a byte address (CMOVE>, BLANK,
ERASE, FILL wrote into the system's code), the standard's results (COMPARE, SEARCH,
BASE output, THRU, >BODY with FIND's address), v3's descriptions where v3 printed
otherwise, and the cases dropped with their reasons (SP@/SP! by D-2, DABS/DMIN
underflow, CMOVE>.bounds, THRU.negative_end).
make -C v4 test: all v4 tests passed (both widths, mesh-boot, inference).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -805,16 +805,14 @@ static void build(void)
|
||||
* OV: drop drop drop pop pop drop drop
|
||||
* QS 4 + b! @b -if OVP drop 0 MSB ; OVP: drop -1 MAXHI ;
|
||||
* DIV: (UQ/) QS 4 + b! @b -if L3 drop DNEGATE ; L3: drop ;
|
||||
* ZERO: drop drop drop NODE-ERROR b! -1 !b
|
||||
* over over OR if Z0 drop -if ZP drop drop 0 MSB ;
|
||||
* ZP: drop drop -1 MAXHI ; Z0: drop ;
|
||||
* ZERO: drop drop drop drop drop 0 0 ; by zero: 0 (ruled 2026-11-14)
|
||||
* MSB and MAXHI are the high cells of Q min and Q max. Clobbers A and B. */
|
||||
#define SWAP_INLINE() do { O(OVER); O(PUSH); O(PUSH); O(DROP); O(RPOP); O(RPOP); } while (0)
|
||||
#define SUB_INLINE() do { O(PUSH); O(INV); O(RPOP); O(ADD); O(INV); } while (0)
|
||||
#define FWD(op) v4_asm_branch_fwd(&as, V4_OP_##op)
|
||||
#define HERE_(r) v4_asm_resolve(&as, (r), v4_asm_label(&as))
|
||||
{
|
||||
v4_asm_ref zero, l1, l2, chk, chk2, same, noov1, ov1, ov2, ovp, l3, z0, zp;
|
||||
v4_asm_ref zero, l1, l2, chk, chk2, same, noov1, ov1, ov2, ovp, l3;
|
||||
v4_asm_ref d1, d2, d3;
|
||||
v4_cell l_div, l_noov, l_ov;
|
||||
|
||||
@@ -853,14 +851,8 @@ static void build(void)
|
||||
CALL(w_uqdiv); LIT(QS + 4); O(BANG_B); O(FETCH_B); l3 = FWD(MINUS_IF);
|
||||
O(DROP); CALL(w_dnegate); O(SEMI);
|
||||
HERE_(l3); O(DROP); O(SEMI);
|
||||
HERE_(zero);
|
||||
O(DROP); O(DROP); O(DROP);
|
||||
LIT(NODE_ERROR); O(BANG_B); LIT(-1); O(STORE_B);
|
||||
O(OVER); O(OVER); CALL(w_or); z0 = FWD(IF);
|
||||
O(DROP); zp = FWD(MINUS_IF);
|
||||
O(DROP); O(DROP); LIT(0); LIT((v4_cell)V4_MSB); O(SEMI);
|
||||
HERE_(zp); O(DROP); O(DROP); LIT(-1); LIT((v4_cell)(MAXU >> 1)); O(SEMI);
|
||||
HERE_(z0); O(DROP); O(SEMI);
|
||||
HERE_(zero); /* by zero: 0, no error (v3's table, ruled 2026-11-14) */
|
||||
O(DROP); O(DROP); O(DROP); O(DROP); O(DROP); LIT(0); LIT(0); O(SEMI);
|
||||
|
||||
v4_asm_resolve(&as, d1, l_div);
|
||||
v4_asm_resolve(&as, d2, l_div);
|
||||
@@ -1867,8 +1859,8 @@ static uint64_t v3_q48_mul(uint64_t a, uint64_t b)
|
||||
/* Reference Q./ (D-11), by a different method from the FORTH: magnitudes
|
||||
* in 16-bit limbs, |a| * 2^16 divided by |b| one bit at a time, then the
|
||||
* sign applied (rounding toward zero) and the result saturated to Q max or
|
||||
* Q min. Division by zero gives Q max / Q min by the dividend's sign, 0 for
|
||||
* 0 / 0, and *err = 1. */
|
||||
* Q min. Division by zero gives 0 and no error (v3's table, ruled
|
||||
* 2026-11-14). */
|
||||
static void qdiv_ref(v4_ucell al, v4_ucell ah, v4_ucell bl, v4_ucell bh,
|
||||
v4_ucell *rl, v4_ucell *rh, int *err)
|
||||
{
|
||||
@@ -1877,11 +1869,8 @@ static void qdiv_ref(v4_ucell al, v4_ucell ah, v4_ucell bl, v4_ucell bh,
|
||||
unsigned i, k;
|
||||
|
||||
*err = 0;
|
||||
if (bl == 0 && bh == 0) {
|
||||
*err = 1;
|
||||
if (al == 0 && ah == 0) { *rl = 0; *rh = 0; }
|
||||
else if (ah & V4_MSB) { *rl = 0; *rh = V4_MSB; }
|
||||
else { *rl = MAXU; *rh = MAXU >> 1; }
|
||||
if (bl == 0 && bh == 0) { /* 0, no error: v3's table (ruled 2026-11-14) */
|
||||
*rl = 0; *rh = 0;
|
||||
return;
|
||||
}
|
||||
q_to_limbs(al, ah, a, &an);
|
||||
|
||||
Reference in New Issue
Block a user