code wiki / _hdl_build / _f64_quad_gate.nx
_f64_quad_gate.nx
buildroot/runtime/_hdl_build/_f64_quad_gate.nx
about
_f64_quad_gate.nx -- self-validating gate for the GAMS-H Simpson quadrature.
integral of f over [a,b] vs the EXACT closed-form value (free oracle):
int_0^1 x^2 = 1/3 ; int_0^(pi/2) sin = 1 ; int_0^1 e^x = e-1 ; int_1^2 1/x = ln2.
Reports the worst relative error; PASS iff max rel < 2^-29 (~1.9e-9, quadrature-grade).
Durable: QUADRATURE-GATE -> math_engine.log. license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_f64.nxnx_f64_div.nxnx_f64_quad.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 QG_ZERO: i64 = 0 |
| 16 | const QG_ONE: i64 = 0x3FF0000000000000 |
| 17 | const QG_TWO: i64 = 0x4000000000000000 |
| 18 | const QG_THREE: i64 = 0x4008000000000000 |
| 19 | const QG_PIH: i64 = 0x3FF921FB54442D18 // pi/2 |
| 20 | const QG_E: i64 = 0x4005BF0A8B145769 // e |
| 21 | const QG_LN2: i64 = 0x3FE62E42FEFA39EF // ln 2 |
| 22 | const QG_N: i64 = 500 |
functions
| 11 | func qg_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 12 | func qg_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 } |
| 13 | func qg_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 } |
| 25 | func qg_rel(result: i64, known: i64) -> i64 |
| 31 | func main() -> i64 |