nx_pow10_test.nx
buildroot/runtime/nx_pow10_test.nx
about
nx_pow10_test.nx -- the gate the lane's most load-bearing primitive never had.
nx_pow10 sits underneath peptide ionisation (pI), thermal death kinetics
(D/z lethality), shelf life, and stability -- four organs whose numbers are
only as good as this table. It was tested transitively by all of them and
directly by none, which means an error here would have been attributed to
whichever caller noticed it first.
===== HOW YOU LIAR-KILL A MATH PRIMITIVE WITH NO ORACLE ==========
There is no float reference available to check against, and hand-typed
"expected" values would just be a second copy of the same table. So the
oracle is the function's OWN FUNCTIONAL EQUATION:
10^a * 10^b = 10^(a+b)
Nothing about the table or the interpolation is assumed; the identity has
to hold, and the amount by which it fails IS the interpolation error,
measured rather than quoted. T5 scans the whole decade for the worst case
instead of sampling a point that flatters the implementation.
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_pow10.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
| 26 | func t_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 27 | func t_putn(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 - m; sys_write(1, "-" as *u8, 1) } let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, bb, k); return 0 } |
| 29 | func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: main |
| 31 | func main() -> i64 |