nx_debt_gate.nx
buildroot/runtime/nx_debt_gate.nx
about
nx_debt_gate.nx -- R4 GATE: proves debt amortization is bit-exact, detects the minimum-payment trap,
and that avalanche pays LESS total interest than snowball (measured, not asserted by faith).
EXACT ANCHORS (hand-computed, banker's rounding, 1% monthly = 12% APR):
$1,000 @ 12%, pay $2,000 -> 1 month, interest $10.00 (round(1000.00*0.01)=1000c)
$1,000 @ 12%, pay $100 -> 11 months, interest $58.98 (5898c) -- full schedule summed by hand
$300 @ 0%, pay $100 -> 3 months, interest $0
$10,000 @ 24%, pay $100 -> -1 TRAP (interest $200 > payment $100; never amortizes)
MEASURED: A=$10,000@24% min$200 + B=$2,000@6% min$50, budget $500/mo. Avalanche kills the 24% debt
first; snowball kills the small $2,000 debt first. Both pay off; avalanche pays less interest.
Exits 0 iff ALL pass. license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_money.nxnx_debt_payoff.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
| 16 | func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 17 | func g_putn(v: i64) -> i64 |
| 27 | func chk(name: *u8, got: i64, want: i64, st: *i64) -> i64 |
| 33 | func main() -> i64 |