code wiki / (root) / nx_logadd_gate.nx

nx_logadd_gate.nx

buildroot/runtime/nx_logadd_gate.nx

6064 B84 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_logadd_gate.nx -- GATE for the fixed-point log-domain library (nx_logadd_lib), driven IN-PROCESS with no fixture: its subject is arithmetic, so every tooth is a known-answer test against values derived by hand from ln 2, e and ln 3 (S = 1024 units per nat), plus the structural laws a log-sum-exp must obey (identity with minus infinity, symmetry, bounds, monotone tables, a three-way partition that sums to one, determinism across two inits) and one neg-control (a positive argument to the probability reader is clamped AND counted, never silently accepted). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_logadd_lib.nx nx_gate_verdict.nx nx_logadd_gate.nx

imports: nx_syscalls.nxnx_logadd_lib.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write 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_check_eq gv_check gv_puts ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap la_init sys_mmap ↻ la_exp_unit_q30 ilog2_1024 la_exp_unit_q30 ↻ la_horizon gv_check ↻ gv_check_near gv_check ↻ gv_puts ↻ gv_num ↻ la_lse

structs

none

consts

11const G_LN2_Q10: i64 = 710 // 1024 * ln 2 = 709.78
12const G_LN3_Q10: i64 = 1125 // 1024 * ln 3 = 1125.03
13const G_SOFTPLUS_1: i64 = 321 // 1024 * ln(1 + e^-1) = 320.78
14const G_INV_E_Q10: i64 = 377 // 1024 / e = 376.71
15const G_INV_E2_Q10: i64 = 139 // 1024 / e^2 = 138.58
16const G_TOL: i64 = 1 // one Q10 unit: the table's own quantisation
17const G_TOL_SUM: i64 = 3 // a three-way partition may lose one unit per rounding
18const G_THIRD_Q10: i64 = 341 // 1024 / 3 = 341.33
19const G_FAR: i64 = 0 - 20000 // well past the horizon
20const G_EXP_UNIT_Q30: i64 = 1072693760 // 2^30 * e^(-1/1024) = 1,072,693,759.83

functions

22func main() -> i64