lumbda/wasm
russell@unturf.com 988c7cbec7
wat bignums (tag 10): closes whitepaper §2.1 — (expt 2 1024) exact on all 3 tiers
Variable-length signed bignums on the asm-wasm tier. Layout:
  [tag=10, sign:i32, n_limbs:i32, limbs[]:u32]
Little-endian u32 limbs (base 2^32). i64 used for limb-pair products
in bn_mul and for the (rem << 32) | limb shift in bn_divmod_small.

Promotion: num_add/sub/mul/cmp inspect operands and pick the right
representation (fixnum, rational, bignum). Fixnum overflow in +/-/* is
detected by computing in i64 and checking against the 30-bit fixnum
range — outside that, operands lift to bignums.

(expt 2 1024) uses exponentiation-by-squaring through num_mul so
intermediate products auto-promote, returning the exact 309-digit value.

Reader: digit parsing accumulates via num_add/num_mul, so a literal of
any length reads as the narrowest representation that holds it.

Parity corpus: KNOWN_DIVERGE is now empty. 237/237 passing across
python (ref), c-wasm, and asm-wasm. New asserts pin the bignum surface
so a regression breaks make wasm-test immediately.
2026-06-14 16:13:33 -04:00
..
app logo: flip 180° on playground + repl to match homepage inverted-λ 2026-06-14 15:53:56 -04:00
asm wat bignums (tag 10): closes whitepaper §2.1 — (expt 2 1024) exact on all 3 tiers 2026-06-14 16:13:33 -04:00
c wasm/playground: cancel button, asm state-leak fix, restyle to match homepage 2026-06-14 12:13:20 -04:00
dist-repl parity probe: cross-tier corpus + fix python remainder + asm modulo 2026-06-14 15:21:19 -04:00
python wasm/playground: cancel button, asm state-leak fix, restyle to match homepage 2026-06-14 12:13:20 -04:00
repl repl: drop transcript max-width centering — λ> sigils now line up left-flush with active prompt 2026-06-14 16:00:09 -04:00
tests wat bignums (tag 10): closes whitepaper §2.1 — (expt 2 1024) exact on all 3 tiers 2026-06-14 16:13:33 -04:00
Makefile parity probe: cross-tier corpus + fix python remainder + asm modulo 2026-06-14 15:21:19 -04:00