code wiki / (root) / nx_card_rewards.nx

nx_card_rewards.nx

buildroot/runtime/nx_card_rewards.nx

4733 B83 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind librarytopic card
docsdependenciesstructsconstsfunctions

about

nx_card_rewards.nx -- the REWARDS-vs-INTEREST engine (R2+R3 of the credit-card arm). Answers the operator's exact ask: earn rewards on a real spend profile, then NET them against the interest you pay if you carry a balance -- so a person can SEE whether the interest is eating the rewards. No-float, integer-exact cents; composes nx_money (the same fixed-point interest math the ledger + debt engines use -- DRY, Cardinal 15). A card is DATA (category rates in basis points + annual fee + sign-up terms), not hardcoded (Cardinal 11), so it works for ANY card. NEVER-BRICK money analog (#26): pure functions, no side effects, no auto-anything -- this only COMPUTES + tells the truth; a human acts. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_money.nx nx_card_rewards.nx nx_card_adversary_gate.nx nx_card_rewards_gate.nx

imports: nx_money.nx

imported by: nx_card_adversary_gate.nxnx_card_rewards_gate.nx

structs

none

consts

9const K_MAGIC_10000: i64 = 10000

functions

15func cr_rewards_annual(sp: *i64, n: i64, reward_bps: *i64, n_rates: i64, base_bps: i64) -> i64
called by 2: mainmain calls 1: mny_div_round
33func cr_point_bps(points_per_dollar_x100: i64, cents_per_point_x100: i64) -> i64
called by 2: mainmain calls 1: mny_div_round
39func cr_signup_value(spend_in_window: i64, min_spend: i64, bonus: i64) -> i64
called by 1: main
46func cr_interest_annual(avg_balance: i64, apr_pct_num: i64, apr_pct_den: i64) -> i64
53func cr_net_annual(rewards: i64, signup_first_year: i64, annual_fee: i64, interest: i64) -> i64
called by 2: mainmain
59func cr_breakeven_balance(rewards: i64, annual_fee: i64, apr_pct_num: i64, apr_pct_den: i64) -> i64
called by 1: main calls 2: mny_rate_from_pctmny_div_round
72func cr_verdict(net: i64, marginal_floor: i64) -> i64
called by 2: mainmain
80func cr_pick(net_a: i64, net_b: i64) -> i64
called by 2: mainmain