code wiki / _hdl_build / _f64_quad_gate.nx

_f64_quad_gate.nx

buildroot/runtime/_hdl_build/_f64_quad_gate.nx

3495 B70 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic f64
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_f64.nx nx_f64_div.nx nx_f64_quad.nx _f64_quad_gate.nx

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

main qg_p sys_write nx_f64_quad_simpson qf_i2f 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_div nx_f64_classify ↻ nx_f64_sign ↻ nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack ↻ nx_f64_sub nx_f64_add ↻ nx_f64_neg nx_f64_add ↻ qf_eval nx_f64_mul nx_f64_classify ↻ nx_f64_sign ↻ nx_f64_mant_field ↻ nx_f64_exp_field ↻ _f64_round_pack ↻ nx_f64_sin 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 ↻

structs

none

consts

15const QG_ZERO: i64 = 0
16const QG_ONE: i64 = 0x3FF0000000000000
17const QG_TWO: i64 = 0x4000000000000000
18const QG_THREE: i64 = 0x4008000000000000
19const QG_PIH: i64 = 0x3FF921FB54442D18 // pi/2
20const QG_E: i64 = 0x4005BF0A8B145769 // e
21const QG_LN2: i64 = 0x3FE62E42FEFA39EF // ln 2
22const QG_N: i64 = 500

functions

11func 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 }
called by 1: main calls 1: sys_write
12func 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 }
called by 1: main calls 1: sys_write
13func 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 }
called by 1: main calls 2: sys_mmapsys_write
25func qg_rel(result: i64, known: i64) -> i64
called by 1: main calls 2: nx_f64_subnx_f64_div
31func main() -> i64