nx_q14_format_test.nx
buildroot/runtime/nx_q14_format_test.nx
about
nx_q14_format_test.nx -- Q14 decimal formatter against known values.
Closed-form invariants:
(a) nx_int_to_decimal(0) -> "0" (1 byte)
(b) nx_int_to_decimal(305) -> "305" (3 bytes)
(c) nx_int_to_decimal(-42) -> "-42" (3 bytes)
(d) nx_int_to_decimal(123456789) -> "123456789" (9 bytes)
(e) nx_q14_to_decimal(0, 3 frac) -> "0.000" (5 bytes)
(f) nx_q14_to_decimal(16384, 3 frac) -> "1.000" (5 bytes)
(g) nx_q14_to_decimal(-24576, 3 frac) -> "-1.500" (6 bytes)
(h) nx_q14_to_decimal(4997120, 3 frac) -> "305.000" (Christus
statue typical height in mm; 305 * 16384 = 4997120 Q14)
(i) Capacity check: writing into a 2-byte buf returns -1 for any
value needing >= 3 chars.
(j) frac_digits = 0 produces no decimal point.
expect_exit: 0
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_q14_format.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
| none |
functions
| 24 | func smoke_buf_eq(buf: *u8, expected: *u8, n: i64) -> i64 called by 1: main |
| 33 | func main() -> i64 |