code wiki / _hdl_build / nx_compound_interest.nx

nx_compound_interest.nx

buildroot/runtime/_hdl_build/nx_compound_interest.nx

4991 B83 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_compound_interest.nx -- the COMPOUND INTEREST tool (X-FIN-COMP-001, financial literacy = the Moroni horns). The operator's keystone: the math the predatory system profits from people NOT understanding. Shows the DUAL NATURE honestly -- the SAME exponential builds wealth FOR you (savings/investing) and buries you AGAINST you (debt) -- so a person SEES it and can defend themselves. Exact integer math (cents + basis- point rates, period-by-period), no f64 rounding games; no-overclaim (real numbers, not get-rich-quick). compound(principal_cents, rate_bps_per_period, periods) -> final cents. Durable: COMPOUND rows -> knowledge/status/compound.log. Exit 0 = KATs hold. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_compound_interest.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main _p sys_write sys_openat_append sys_exit ci_compound ci_contributed _fp sys_write ↻ ci_dollars _fp ↻ _fn sys_mmap sys_write ↻ _fn ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_close

structs

none

consts

11const K_MAGIC_5000: i64 = 5000
12const K_MAGIC_10000: i64 = 10000
13const K_MAGIC_100000: i64 = 100000
14const K_MAGIC_162800: i64 = 162800
15const K_MAGIC_162950: i64 = 162950
16const K_MAGIC_500000: i64 = 500000
17const K_MAGIC_20000: i64 = 20000

functions

18func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
19func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 2: ci_dollarsmain calls 1: sys_write
20func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" 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(fd,bb,k); return 0 }
called by 2: ci_dollarsmain calls 2: sys_mmapsys_write
23func ci_compound(principal: i64, rate_bps: i64, periods: i64, contrib: i64) -> i64
called by 1: main
35func ci_contributed(principal: i64, periods: i64, contrib: i64) -> i64
called by 1: main
38func ci_dollars(fd: i64, cents: i64) -> i64
called by 1: main calls 2: _fp_fn
45func main() -> i64