code wiki / (root) / nx_force_test.nx

nx_force_test.nx

buildroot/runtime/nx_force_test.nx

3873 B102 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_force_test.nx -- 3D force vector ops verified against hand- computed physics reference cases. Closed-form invariants (Q14 N throughout): (a) Zero force: magnitude == 0. (b) Unit +X force: (Q14, 0, 0) magnitude == Q14. (c) (3, 4, 0) Q14 Newtons magnitude == 5 Q14 (3-4-5 triangle). (d) Gravity on 1 kg: (0, 0, -9.80665 N) ≈ (0, 0, -160665 Q14). (e) Gravity on 2 kg: 2x the above magnitude. (f) Vector add: (1, 2, 3) + (4, 5, 6) = (5, 7, 9). (g) Vector sub: (5, 7, 9) - (4, 5, 6) = (1, 2, 3). (h) Scale by 2.0 (32768 Q14): doubles each component. (i) Dot product (1, 0, 0)·(0, 1, 0) = 0 (perpendicular). (j) Dot product (1, 2, 3)·(1, 2, 3) = 1 + 4 + 9 = 14 N² → 14 Q14 (each side has Q14 N; product is Q14 N², ratio Q14). (k) Cross product +X × +Y = +Z (right-hand rule). (l) Verdict name lookup non-NULL for every verdict. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_force.nx nx_force_test.nx

imports: nx_syscalls.nxnx_force.nx

imported by: nobody (leaf or entry point)

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

main nx_force_zero nx_force_new sys_mmap nx_force_magnitude_q14 nx_isqrt nx_force_new ↻ near nx_force_gravity_on_kg nx_muldiv_i64 nx_i128_alloc nx_i128_mul_i64 nx_i128_mul_u64 nx_i128_neg nx_i128_div_i64 nx_i128_is_neg nx_i128_neg ↻ nx_i128_udiv_u64 nx_force_new ↻ nx_force_add nx_force_new ↻ nx_force_sub nx_force_new ↻ nx_force_scale nx_force_new ↻ nx_muldiv_i64 ↻ nx_force_dot nx_muldiv_i64 ↻ nx_force_cross nx_muldiv_i64 ↻ nx_force_new ↻ nx_force_verdict_name

structs

none

consts

25const Q14: i64 = 16384

functions

28func near(actual: i64, expected: i64, tol: i64) -> i64
called by 1: main
35func main() -> i64