code wiki / (root) / nx_units.nx

nx_units.nx

buildroot/runtime/nx_units.nx

5835 B133 linesdepth 6pulls 6 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_units.nx -- SI units + dimensional-analysis engine. Foundation for native physics primitives. Per user 2026-05-15: "physics and chemistry and higher math". Patent-clean SI base + derived units. 7-D dimensional vector (m, kg, s, A, K, mol, cd) tracks every quantity. nx_dim_check validates equations: F = m * a is OK because [N] = [kg][m/s^2].

dependencies 1 imports · 1 importers

nx_kernel_v2.nx nx_units.nx nx_capabilities_test.nx

imports: nx_kernel_v2.nx

imported by: nx_capabilities_test.nx

structs

41struct Dim
104struct PhysConst

consts

17const NX_MAGIC_299792458: i64 = 299792458
18const NX_MAGIC_662607015: i64 = 662607015
19const NX_MAGIC_66743: i64 = 66743
20const NX_MAGIC_1602176634: i64 = 1602176634
23const NX_UNIT_SYM_METER: nx_int = 413001
24const NX_UNIT_SYM_KG: nx_int = 413002
25const NX_UNIT_SYM_SEC: nx_int = 413003
26const NX_UNIT_SYM_AMPERE: nx_int = 413004
27const NX_UNIT_SYM_KELVIN: nx_int = 413005
28const NX_UNIT_SYM_MOL: nx_int = 413006
29const NX_UNIT_SYM_CANDELA: nx_int = 413007
30const NX_UNIT_SYM_NEWTON: nx_int = 413008
31const NX_UNIT_SYM_JOULE: nx_int = 413009
32const NX_UNIT_SYM_WATT: nx_int = 413010
33const NX_UNIT_SYM_PASCAL: nx_int = 413011
34const NX_UNIT_SYM_HZ: nx_int = 413012
35const NX_UNIT_SYM_VOLT: nx_int = 413013
36const NX_UNIT_SYM_OHM: nx_int = 413014
44const NX_DIM_BYTES: nx_int = 56
109const NX_PCONST_BYTES: nx_int = 24

functions

46func nx_dim_new(m: nx_int, kg: nx_int, s: nx_int, a: nx_int, k: nx_int, mol: nx_int, cd: nx_int) -> *Dim
52func nx_dim_zero() -> *Dim { return nx_dim_new(0, 0, 0, 0, 0, 0, 0) }
calls 1: nx_dim_new
55func nx_dim_meter() -> *Dim { return nx_dim_new(1, 0, 0, 0, 0, 0, 0) }
called by 1: nx_const_grav calls 1: nx_dim_new
56func nx_dim_kg() -> *Dim { return nx_dim_new(0, 1, 0, 0, 0, 0, 0) }
57func nx_dim_sec() -> *Dim { return nx_dim_new(0, 0, 1, 0, 0, 0, 0) }
58func nx_dim_ampere() -> *Dim { return nx_dim_new(0, 0, 0, 1, 0, 0, 0) }
59func nx_dim_kelvin() -> *Dim { return nx_dim_new(0, 0, 0, 0, 1, 0, 0) }
calls 1: nx_dim_new
60func nx_dim_mol() -> *Dim { return nx_dim_new(0, 0, 0, 0, 0, 1, 0) }
calls 1: nx_dim_new
61func nx_dim_candela() -> *Dim { return nx_dim_new(0, 0, 0, 0, 0, 0, 1) }
calls 1: nx_dim_new
64func nx_dim_newton() -> *Dim { return nx_dim_new(1, 1, 0 - 2, 0, 0, 0, 0) } // kg*m/s^2
65func nx_dim_joule() -> *Dim { return nx_dim_new(2, 1, 0 - 2, 0, 0, 0, 0) } // N*m
66func nx_dim_watt() -> *Dim { return nx_dim_new(2, 1, 0 - 3, 0, 0, 0, 0) } // J/s
called by 1: t2_dim_analysis calls 1: nx_dim_new
67func nx_dim_pascal() -> *Dim { return nx_dim_new(0 - 1, 1, 0 - 2, 0, 0, 0, 0) } // N/m^2
calls 1: nx_dim_new
68func nx_dim_hz() -> *Dim { return nx_dim_new(0, 0, 0 - 1, 0, 0, 0, 0) } // 1/s
calls 1: nx_dim_new
69func nx_dim_volt() -> *Dim { return nx_dim_new(2, 1, 0 - 3, 0 - 1, 0, 0, 0) } // W/A
calls 1: nx_dim_new
70func nx_dim_ohm() -> *Dim { return nx_dim_new(2, 1, 0 - 3, 0 - 2, 0, 0, 0) } // V/A
calls 1: nx_dim_new
71func nx_dim_velocity() -> *Dim { return nx_dim_new(1, 0, 0 - 1, 0, 0, 0, 0) }
72func nx_dim_acceleration() -> *Dim { return nx_dim_new(1, 0, 0 - 2, 0, 0, 0, 0) }
76func nx_dim_mul(a: *Dim, b: *Dim) -> *Dim
80func nx_dim_div(a: *Dim, b: *Dim) -> *Dim
84func nx_dim_pow(a: *Dim, n: nx_int) -> *Dim
90func nx_dim_eq(a: *Dim, b: *Dim) -> nx_int
111func nx_pconst(m: nx_int, e: nx_int, d: *Dim) -> *PhysConst
117func nx_const_speed_of_light() -> *PhysConst
120func nx_const_planck() -> *PhysConst
124func nx_const_grav() -> *PhysConst
130func nx_const_elementary_charge() -> *PhysConst