nx_units.nx
buildroot/runtime/nx_units.nx
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
imports: nx_kernel_v2.nx
imported by: nx_capabilities_test.nx
structs
| 41 | struct Dim |
| 104 | struct PhysConst |
consts
| 17 | const NX_MAGIC_299792458: i64 = 299792458 |
| 18 | const NX_MAGIC_662607015: i64 = 662607015 |
| 19 | const NX_MAGIC_66743: i64 = 66743 |
| 20 | const NX_MAGIC_1602176634: i64 = 1602176634 |
| 23 | const NX_UNIT_SYM_METER: nx_int = 413001 |
| 24 | const NX_UNIT_SYM_KG: nx_int = 413002 |
| 25 | const NX_UNIT_SYM_SEC: nx_int = 413003 |
| 26 | const NX_UNIT_SYM_AMPERE: nx_int = 413004 |
| 27 | const NX_UNIT_SYM_KELVIN: nx_int = 413005 |
| 28 | const NX_UNIT_SYM_MOL: nx_int = 413006 |
| 29 | const NX_UNIT_SYM_CANDELA: nx_int = 413007 |
| 30 | const NX_UNIT_SYM_NEWTON: nx_int = 413008 |
| 31 | const NX_UNIT_SYM_JOULE: nx_int = 413009 |
| 32 | const NX_UNIT_SYM_WATT: nx_int = 413010 |
| 33 | const NX_UNIT_SYM_PASCAL: nx_int = 413011 |
| 34 | const NX_UNIT_SYM_HZ: nx_int = 413012 |
| 35 | const NX_UNIT_SYM_VOLT: nx_int = 413013 |
| 36 | const NX_UNIT_SYM_OHM: nx_int = 413014 |
| 44 | const NX_DIM_BYTES: nx_int = 56 |
| 109 | const NX_PCONST_BYTES: nx_int = 24 |
functions
| 46 | func 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 |
| 52 | func nx_dim_zero() -> *Dim { return nx_dim_new(0, 0, 0, 0, 0, 0, 0) } calls 1: nx_dim_new |
| 55 | func nx_dim_meter() -> *Dim { return nx_dim_new(1, 0, 0, 0, 0, 0, 0) } |
| 56 | func nx_dim_kg() -> *Dim { return nx_dim_new(0, 1, 0, 0, 0, 0, 0) } |
| 57 | func nx_dim_sec() -> *Dim { return nx_dim_new(0, 0, 1, 0, 0, 0, 0) } called by 5: t2_dim_analysist3_constantsnx_const_plancknx_const_gravnx_const_elementary_charge calls 1: nx_dim_new |
| 58 | func nx_dim_ampere() -> *Dim { return nx_dim_new(0, 0, 0, 1, 0, 0, 0) } |
| 59 | func nx_dim_kelvin() -> *Dim { return nx_dim_new(0, 0, 0, 0, 1, 0, 0) } calls 1: nx_dim_new |
| 60 | func nx_dim_mol() -> *Dim { return nx_dim_new(0, 0, 0, 0, 0, 1, 0) } calls 1: nx_dim_new |
| 61 | func nx_dim_candela() -> *Dim { return nx_dim_new(0, 0, 0, 0, 0, 0, 1) } calls 1: nx_dim_new |
| 64 | func nx_dim_newton() -> *Dim { return nx_dim_new(1, 1, 0 - 2, 0, 0, 0, 0) } // kg*m/s^2 |
| 65 | func nx_dim_joule() -> *Dim { return nx_dim_new(2, 1, 0 - 2, 0, 0, 0, 0) } // N*m |
| 66 | func nx_dim_watt() -> *Dim { return nx_dim_new(2, 1, 0 - 3, 0, 0, 0, 0) } // J/s |
| 67 | func 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 |
| 68 | func nx_dim_hz() -> *Dim { return nx_dim_new(0, 0, 0 - 1, 0, 0, 0, 0) } // 1/s calls 1: nx_dim_new |
| 69 | func nx_dim_volt() -> *Dim { return nx_dim_new(2, 1, 0 - 3, 0 - 1, 0, 0, 0) } // W/A calls 1: nx_dim_new |
| 70 | func nx_dim_ohm() -> *Dim { return nx_dim_new(2, 1, 0 - 3, 0 - 2, 0, 0, 0) } // V/A calls 1: nx_dim_new |
| 71 | func nx_dim_velocity() -> *Dim { return nx_dim_new(1, 0, 0 - 1, 0, 0, 0, 0) } |
| 72 | func nx_dim_acceleration() -> *Dim { return nx_dim_new(1, 0, 0 - 2, 0, 0, 0, 0) } |
| 76 | func nx_dim_mul(a: *Dim, b: *Dim) -> *Dim |
| 80 | func nx_dim_div(a: *Dim, b: *Dim) -> *Dim |
| 84 | func nx_dim_pow(a: *Dim, n: nx_int) -> *Dim |
| 90 | func nx_dim_eq(a: *Dim, b: *Dim) -> nx_int |
| 111 | func nx_pconst(m: nx_int, e: nx_int, d: *Dim) -> *PhysConst |
| 117 | func nx_const_speed_of_light() -> *PhysConst |
| 120 | func nx_const_planck() -> *PhysConst |
| 124 | func nx_const_grav() -> *PhysConst |
| 130 | func nx_const_elementary_charge() -> *PhysConst |