code wiki / (root) / fx_gate.nx

fx_gate.nx

buildroot/runtime/fx_gate.nx

5222 B108 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic fx
docsdependenciesstructsconstsfunctions

about

fx_gate.nx -- the gate for the Q16.16 fixed-point math 49 modules import. WHY: nx_gensota gen-3 worklist. This module exists for ONE reason -- bit-identical simulation across machines (rollback netcode); IEEE-754 cannot deliver it. Its header numbers four invariants FX1-FX4, and an invariant nothing checks is a wish. ★SCOPE DECLARED HONESTLY: determinism has an IN-PROCESS half (same input -> same bits, every call) and a CROSS-MACHINE half (same bits on every target). T9 proves the first. The second CANNOT be proven from one host and is NOT claimed here -- it would need the same vectors run on a second architecture and compared. Saying so beats a gate that implies coverage it lacks. ⚠OPEN QUESTION FILED, NOT GUESSED (see debt): FX2 says fx_mul and fx_div "round toward zero (arithmetic shift)" -- but an arithmetic right shift rounds toward NEGATIVE INFINITY on negatives while integer division truncates toward ZERO, so the two may DISAGREE on negative operands. Rather than pin a guessed direction, T5 asserts the property that is true either way and matters to callers: the result is within ONE ULP of the exact product. license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx fx.nx fx_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxfx.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 ↻ gv_check gv_puts ↻ fx_to_int fx_from_int fx_mul fx_div fxg_abs fx_from_frac fx_log2 fx_mul ↻ gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n gv_at ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

none

functions

19func fxg_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: main
21func main() -> i64