code wiki / _hdl_build / _bf_erf_gate_authored.nx

_bf_erf_gate_authored.nx

buildroot/runtime/_hdl_build/_bf_erf_gate_authored.nx

6149 B151 linesdepth 5pulls 9 transitivereach 0 importersview sourcekind tooltopic bf
docsdependenciesstructsconstsfunctions

about

_bf_erf_gate_authored.nx -- the ENGINEER's INDEPENDENT semantic gate for the Builder-authored erf (ME2-ERF-001 component 4/5). Judge independence: this gate RE-DERIVES 2/sqrt(pi) itself (bf_pi + Newton sqrt -- not read from the spec) and evaluates erf at every grid point with a 44-term 120-bit series, then compares the kernel's f64 BITS against the bf-rounded oracle. RUNG-1 BAR: max ULP <= 4 over x = k/64 for k=1..112 (0.015625 .. 1.75 inclusive) + k/4096 for k=1..8 (small-x). MAGNITUDE-ONLY LANDMINE (caught live 2026-06-12): alternating series is summed as POS(even n) and NEG(odd n) separately, subtracted bf_cmp-ordered. Positive grid suffices: antisymmetry is BIT-EXACT by construction (invariant test). Durable: BFERF rows -> knowledge/status/math_engine.log. Exit 0 iff bar held. license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_bigfloat120.nx nx_bigfloat120_div.nx nx_bigfloat120_trig.nx _pe_f64erf.nx _bf_erf_gate_authored.nx

imports: nx_syscalls.nxnx_bigfloat120.nxnx_bigfloat120_div.nxnx_bigfloat120_trig.nx_pe_f64erf.nx

imported by: nobody (leaf or entry point)

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

main bg_p sys_write bf_new sys_mmap bf_pi bf_new ↻ bf_atan_inv bf_new ↻ bf_set_int bf_div_small bf_is_zero bf_copy bf_norm bf_mul bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_copy ↻ bf_add bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_shr2 bf_norm ↻ bf_sub bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_shr2 ↻ bf_norm ↻ bf_sub ↻ bg_sqrt bf_new ↻ bf_set_f64 bf_div bf_is_zero ↻ bf_copy ↻ bf_norm ↻ bf_add ↻

structs

none

consts

none

functions

17func bg_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
18func bg_f(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
19func bg_n(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
21func bg_sqrt(out: *i64, a: *i64, seed_raw: i64) -> i64
36func bg_erf_oracle(xbits: i64, tosp: *i64) -> i64
71func bg_ulp(a: i64, b: i64) -> i64
called by 1: main
75func main() -> i64