code wiki / (root) / nx_quadrature_gate.nx

nx_quadrature_gate.nx

buildroot/runtime/nx_quadrature_gate.nx

5788 B71 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_quadrature_gate.nx -- computational CM4: adaptive quadrature with a MEASURED error bound that REFUSES rather than lie. In-process over nx_quadrature (the one ruler), analytic KATs whose exact values are closed forms: x^2 on [0,1] = 1/3 · x^3 on [0,2] = 4 (Simpson-exact: must cost the minimum evaluations) · 1/(1+x^2) on [0,1] = pi/4 · a sharp peak 1/(0.01+x^2) on [-1,1] = 20 atan(10) (forces deep subdivision near 0) · |x| on [-1,1] = 1 (a kink the adaptive split must resolve). Honesty teeth: |value - exact| <= the reported error bound on EVERY KAT; a tolerance below binary64 resolution on the result's scale returns NQ_REFUSED_TOL with the best value still carried; a > b and tol <= 0 are refused as bad input; an integrand that returns NaN is refused as NONFINITE. The refusal teeth are the neg-controls: an implementation that always returns OK cannot pass them. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_quadrature.nx nx_quadrature_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_quadrature.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ gv_puts sys_write ↻ qg_kat sys_mmap ↻ ni_quad_adaptive nq_finite sys_mmap ↻ nq_simpson nq_node nq_finite ↻ nq_simpson ↻ nq_abs nq_node ↻ qg_tol qg_abs qg_slack gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_check gv_puts ↻

structs

none

consts

none

functions

16func qg_pi_4() -> f64 { return 0.7853981633974483 }
called by 1: main
17func qg_peak_exact() -> f64 { return 29.42255348607467 } // 20 * atan(10)
called by 1: main
18func qg_tol() -> f64 { return 0.000000001 } // 1e-9 absolute, the KAT tolerance
called by 2: qg_katmain
21func qg_tol_impossible() -> f64 { return 0.000000001 * 0.000000001 * 0.01 }
called by 1: main
22func qg_slack() -> f64 { return 0.000000000001 } // 1e-12 rounding slack allowed on top of the reported bound
called by 1: qg_kat
24func qg_sq(x: f64) -> f64 { return x * x }
25func qg_cube(x: f64) -> f64 { return x * x * x }
26func qg_lorentz(x: f64) -> f64 { return 1.0 / (1.0 + x * x) }
27func qg_peak(x: f64) -> f64 { return 1.0 / (0.01 + x * x) }
28func qg_absx(x: f64) -> f64 { if x < 0.0 { return 0.0 - x } return x }
29func qg_nan(x: f64) -> f64 { let z: f64 = 0.0; return z / z }
31func qg_abs(x: f64) -> f64 { if x < 0.0 { return 0.0 - x } return x }
called by 2: qg_katmain
33func qg_kat(name: *u8, f: func(f64) -> f64, a: f64, b: f64, exact: f64, c: *i64) -> i64
47func main() -> i64