nx_force_test.nx
buildroot/runtime/nx_force_test.nx
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
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
structs
| none |
consts
| 25 | const Q14: i64 = 16384 |
functions
| 28 | func near(actual: i64, expected: i64, tol: i64) -> i64 called by 1: main |
| 35 | func main() -> i64 |