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