code wiki / _hdl_build / nx_compound_interest.nx
nx_compound_interest.nx
buildroot/runtime/_hdl_build/nx_compound_interest.nx
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
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
structs
| none |
consts
| 11 | const K_MAGIC_5000: i64 = 5000 |
| 12 | const K_MAGIC_10000: i64 = 10000 |
| 13 | const K_MAGIC_100000: i64 = 100000 |
| 14 | const K_MAGIC_162800: i64 = 162800 |
| 15 | const K_MAGIC_162950: i64 = 162950 |
| 16 | const K_MAGIC_500000: i64 = 500000 |
| 17 | const K_MAGIC_20000: i64 = 20000 |
functions
| 18 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 19 | func _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 } |
| 20 | func _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 } |
| 23 | func ci_compound(principal: i64, rate_bps: i64, periods: i64, contrib: i64) -> i64 called by 1: main |
| 35 | func ci_contributed(principal: i64, periods: i64, contrib: i64) -> i64 called by 1: main |
| 38 | func ci_dollars(fd: i64, cents: i64) -> i64 |
| 45 | func main() -> i64 |