code wiki / _hdl_build / nx_geo_query_gate.nx

nx_geo_query_gate.nx

buildroot/runtime/_hdl_build/nx_geo_query_gate.nx

3619 B71 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_query_gate.nx -- GATE for GEO-009 spatial query. Proves: nearest : among {LA, Boston, Philadelphia}, nearest to NYC is Philadelphia (index 2) within : within 200 km of NYC = {Philadelphia} only (Boston ~306 km out, LA out) bearing : due N=0, due E=90, due S=180, due W=270, NE@equator=45 (the compass quadrants) Evidence -> knowledge/status/geo_query.log (GEOQUERYGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_geo_query.nx nx_syscalls.nx nx_geo_query_gate.nx

imports: nx_geo_query.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap gq_set geo_nearest geo_distance_m fx_cos fx_sin_cos fx_normalize_angle fx_cordic_atan nx_isqrt geo_within geo_distance_m ↻ geo_bearing fx_cos ↻ geo_atan2 fx_cordic_atan ↻ gq_near gq_emit gq_w sys_write gq_wn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close

structs

none

consts

11const GQ_LOG: *u8 = "knowledge/status/geo_query.log"

functions

13func gq_w(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: gq_emit calls 1: sys_write
14func gq_wn(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;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: gq_emit calls 2: sys_mmapsys_write
16func gq_near(a: i64, b: i64, tol: i64) -> i64 { var d: i64 = a - b; if d < 0 { d = 0 - d } if d <= tol { return 1 } return 0 }
called by 1: main
18func gq_set(p: *i64, i: i64, lat: i64, lon: i64) -> i64 { p[i * 2] = lat; p[i * 2 + 1] = lon; return 0 }
called by 1: main
20func gq_emit(fd: i64, near: i64, wcount: i64, widx: i64, bN: i64, bE: i64, bS: i64, bW: i64, bNE: i64, ok: i64) -> i64
called by 1: main calls 2: gq_wgq_wn
33func main() -> i64