code wiki / _hdl_build / nx_phys_units.nx
nx_phys_units.nx
buildroot/runtime/_hdl_build/nx_phys_units.nx
about
nx_phys_units.nx -- the SOVEREIGN INTEGER-EXACT dimensional-analysis engine (science-exceed arc,
rung PHYS-UNITS). A physical quantity's DIMENSION is the vector of 7 INTEGER SI-base exponents
[L,M,T,I,TH,N,J]. Dimensional algebra is therefore PURE INTEGER -- multiply = ADD exponent vectors,
divide = SUBTRACT, power = SCALE, "compatible for +/compare" = EXACT vector equality. No float
anywhere -> exact, deterministic, reproducible, attestable.
EXCEED THESIS vs Mathematica Quantity/UnitConvert (the top-down incumbent): Mathematica is float-
magnitude + proprietary + cloud-tethered; Nishi tracks dimensions as exact integer vectors, sovereign
+ offline + bit-attestable. We do NOT out-breadth Wolfram -- we win on EXACTNESS + SOVEREIGNTY.
Data-driven (rule-11): the unit->dimension map is knowledge/registry/sci_units.tsv (no magic numbers
in code). BAKED GATE proves the algebra on real physics identities (F=ma, E=F*d, P=E/t exact) +
a NEGATIVE control (force != energy -> rejected) before emitting verdict=GREEN.
module: nishi-core.science.phys_units
depends: nishi-core.sys.syscalls
capability: INTEGER_EXACT_DIMENSIONAL_ANALYSIS
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 20 | const PU_MAGIC_65536: i64 = 65536 |
| 22 | const PU_REF: *u8 = "knowledge/registry/sci_units.tsv" |
| 23 | const PU_LOG: *u8 = "knowledge/status/phys_units.log" |
functions
| 25 | func pu_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 } |
| 26 | func pu_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 } |
| 28 | func pu_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 39 | func pu_field(buf: *u8, ls: i64, le: i64, f: i64, dst: *u8, cap: i64) -> i64 called by 1: pu_lookup |
| 53 | func pu_atoi(s: *u8, len: i64) -> i64 called by 1: pu_lookup |
| 61 | func pu_streq(a: *u8, b: *u8) -> i64 called by 1: pu_lookup |
| 69 | func pu_mul(out: *i64, a: *i64, b: *i64) -> i64 { var k: i64=0; while k<7 { out[k]=a[k]+b[k]; k=k+1 } return 0 } called by 1: main |
| 70 | func pu_div(out: *i64, a: *i64, b: *i64) -> i64 { var k: i64=0; while k<7 { out[k]=a[k]-b[k]; k=k+1 } return 0 } called by 1: main |
| 71 | func pu_eq(a: *i64, b: *i64) -> i64 { var k: i64=0; while k<7 { if a[k]!=b[k] { return 0 } k=k+1 } return 1 } called by 1: main |
| 74 | func pu_lookup(rbuf: *u8, rn: i64, name: *u8, dim: *i64) -> i64 |
| 102 | func main() -> i64 |