code wiki / (root) / nx_vecmath_gate.nx

nx_vecmath_gate.nx

buildroot/runtime/nx_vecmath_gate.nx

18215 B344 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic vecmath
docsdependenciesstructsconstsfunctions

about

nx_vecmath_gate.nx -- THE GATE for the shared integer linear-algebra foundation (PG2, procgen.plan). GATE LAW APPLIED (CLAUDE.md "EVERY GATE YOU WRITE"): 1. returns gv_verdict so the EXIT CODE carries the verdict -- /api/gate_run derives GREEN/RED from it, and a gate that returns a bare 0 after printing RED silently blesses every failure it finds. 2. two teeth are named neg-control-* so the L2 census can SEE them. 3. every tooth is a gv_check on the shared counter, so DECLARED == EXECUTED by construction. A hand-rolled tally can print "passed 22/20"; this cannot. 4. every sweep is bound to its denominator via gv_subjects. A tooth that passes on the empty set is not a tooth, and these sweeps are the whole representable population, never a sample. 5. every tooth PRINTS ITS MEASURED VALUE. A boolean cannot say why, and both vacuous teeth this estate has caught were found in the diagnostic dump, never in the verdict vector. 6. the verdict note does NOT recite the teeth. Each gv_check name states its own strength, so adding a tooth can never make a summary sentence lie. ERROR BARS ARE DERIVED AND THE MEASUREMENT IS PRINTED BESIDE THEM. nx_itrig declares ~0.6 percent amplitude error, which at fx4096 is about 25 units of value and therefore about 25 units of ANGLE once a point is perturbed off the unit circle. The single-term atan form contributes about 20 units. The bars below sit at roughly twice their sum so a tooth fails on a REGRESSION rather than on the known approximation, and the printed maximum makes the bar ratchetable on evidence instead of by taste.

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_vecmath.nx nx_vecmath_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_vecmath.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ vm_one vm_sin it_sin4096 vm_pi vm_pi2 gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_check gv_puts ↻ vm_abs vg_dev gv_subjects gv_puts ↻ gv_num ↻ gv_need gv_puts ↻ vm_isqrt

structs

none

consts

26const VG_I64: i64 = 8
27const VG_V3B: i64 = 24 // 3 * VG_I64
28const VG_V4B: i64 = 32 // 4 * VG_I64
29const VG_M3B: i64 = 72 // 9 * VG_I64
32const VG_ANG_BAR: i64 = 96 // composite sin-cos-atan2 round-trip, units of rad*4096
33const VG_ACOS_BAR: i64 = 96 // acos(cos(a)) round-trip, same basis
34const VG_UNIT_BAR: i64 = 24 // |normalise(v)| vs VM_ONE: pure fixed-point quantisation, no trig involved
35const VG_ORTH_BAR: i64 = 24 // dot(cross(a,b), a) vs zero
36const VG_M3_BAR: i64 = 48 // matrix round-trip and rotation-path agreement
40const VG_POLE_AMP: i64 = 16
44const VG_ISQRT_N: i64 = 3000
45const VG_FLOOR_N: i64 = 20000
46const VG_ACOS_N: i64 = 4096 // every representable cosine in [0, VM_ONE]

functions

48func vg_dev(a: i64, b: i64) -> i64 { if a > b { return a - b } return b - a }
called by 1: main
51func vg_angdev(a: i64, b: i64) -> i64
called by 1: main calls 3: vm_pivm_tauvm_abs
58func main() -> i64