code wiki / _hdl_build / _f64_rootfind_gate.nx
_f64_rootfind_gate.nx
buildroot/runtime/_hdl_build/_f64_rootfind_gate.nx
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
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
structs
| none |
consts
| 15 | const RG_ONE: i64 = 0x3FF0000000000000 |
| 16 | const RG_TWO: i64 = 0x4000000000000000 |
| 17 | const RG_ZERO: i64 = 0 |
functions
| 10 | func 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 } |
| 11 | func 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 } |
| 12 | func 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 } |
| 13 | func rg_ulp(a: i64, b: i64) -> i64 { if a >= b { return a - b } return b - a } called by 1: main |
| 19 | func main() -> i64 |