code wiki / (root) / nx_acceleration_test.nx

nx_acceleration_test.nx

buildroot/runtime/nx_acceleration_test.nx

3555 B86 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_acceleration_test.nx -- acceleration vector ops + Newton's second-law roundtrip composition with nx_force. Closed-form invariants (Q14 m/s² unless noted): (a) Zero magnitude == 0. (b) Earth gravity = (0, 0, -9.80665 m/s²) → fz_q14 ≈ -160665. (c) Gravity magnitude ≈ 160665 Q14 (= 9.80665 m/s² × Q14_ONE). (d) 3-4-5 triangle in acceleration space. (e) Add: (1, 2, 3) + (4, 5, 6) = (5, 7, 9). (f) Scale by 2.0 (32768 Q14) doubles each component. (g) Newton's second law roundtrip: gravity × 1 kg ≈ matches nx_force_gravity_on_kg(1 kg). Allows ±2 Q14 tolerance for the two-step Q14 chain (mass×accel/Q14_ONE). (h) F = ma for 5 kg at acceleration (0, 0, -10 m/s²) → F ≈ (0, 0, -50 N). (i) Verdict name lookup non-NULL. expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_force.nx nx_acceleration.nx nx_acceleration_test.nx

imports: nx_syscalls.nxnx_force.nxnx_acceleration.nx

imported by: nobody (leaf or entry point)

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

main nx_acceleration_zero nx_acceleration_new sys_mmap nx_acceleration_magnitude_ nx_isqrt nx_acceleration_g_earth nx_acceleration_new ↻ near nx_acceleration_new ↻ nx_acceleration_add nx_acceleration_new ↻ nx_acceleration_scale nx_acceleration_new ↻ 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_gravity_on_kg nx_muldiv_i64 ↻ nx_force_new sys_mmap ↻ nx_force_from_mass_accel nx_muldiv_i64 ↻ nx_force_new ↻ nx_acceleration_verdict_na

structs

none

consts

24const Q14: i64 = 16384

functions

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