Finance

Implemented — financial numerics on synthetic data only live under examples/13-finance/ and run byte-identically on both engines. Nothing here stores real financial data or connects to any external system.

examples/13-finance/

File

Demonstrates

01_compound_interest.kark

Integer-penny compounding, year by year

02_loan_amortization.kark

Annuity payment via iterated discount factor (no pow needed)

03_npv.kark

Net present value of a discounted cash-flow stream

04_portfolio.kark

Weighted-average portfolio returns with exact integer weights

Compound interest (excerpt)

func compound(start, years, percent) {
    let amount = start
    let year = 0
    while (year < years) {
        amount = amount + amount * percent / 100
        year = year + 1
    }
    return amount
}

Run:

$ karkain run examples/13-finance/01_compound_interest.kark

Note

Float output prints at 6 significant figures on both engines; where exactness matters the examples use integer cents.

See also

Security — hashing and encoding used alongside finance demos in real applications.