code wiki / _hdl_build / _f64_rootfind_gate.nx

_f64_rootfind_gate.nx

buildroot/runtime/_hdl_build/_f64_rootfind_gate.nx

3556 B70 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind gate/prooftopic f64
docsdependenciesstructsconstsfunctions

about

_f64_rootfind_gate.nx -- self-validating gate for the GAMS-F bisection root-finder. For each test function: find the root, assert |f(root)| ~ 0 (< 2^-40, the DEFINING property -- a free oracle). For the two with closed-form roots (sqrt2, ln2) also assert the root matches bit-tight (<= 4 ulp). Durable: ROOTFIND-GATE -> math_engine.log. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_f64.nx nx_f64_rootfind.nx _f64_rootfind_gate.nx

imports: nx_syscalls.nxnx_f64.nxnx_f64_rootfind.nx

imported by: nobody (leaf or entry point)

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

main rg_p sys_write nx_f64_root_bisect rf_eval nx_f64_sub nx_f64_add nx_f64_classify nx_f64_exp_field nx_f64_mant_field nx_f64_sign nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack nx_f64_neg nx_f64_mul nx_f64_classify ↻ nx_f64_sign ↻ nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack ↻ nx_f64_cos sys_mmap _sc_reduce nx_f64_mul ↻ nx_f64_sign ↻ nx_f64_sub ↻ nx_f64_add ↻ nx_f64_to_i64 nx_f64_classify ↻ nx_f64_sign ↻ nx_f64_exp_field ↻ nx_f64_mant_field ↻ nx_i64_to_f64 _f64_round_pack ↻ _sc_cosp nx_f64_mul ↻ nx_f64_add ↻ nx_f64_neg ↻ _sc_sinp

structs

none

consts

15const RG_ONE: i64 = 0x3FF0000000000000
16const RG_TWO: i64 = 0x4000000000000000
17const RG_ZERO: i64 = 0

functions

10func rg_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
11func rg_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
12func rg_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
13func rg_ulp(a: i64, b: i64) -> i64 { if a >= b { return a - b } return b - a }
called by 1: main
19func main() -> i64