Add splitwise module: equal/exact/percent/share split strategies with largest-remainder paise arithmetic, derived ledger, greedy and exact debt simplification, concurrency control (13 tests, 12 transcripts)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4aCTv6BYCer55YdjZ
This commit is contained in:
Claude
2026-11-17 23:16:53 +05:30
parent c57031aaeb
commit eef175d669
42 changed files with 1772 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
Pitfalls that look fine until they are not
==========================================
1. new BigDecimal(33.33) = 33.3299999999999982946974341757595539093017578125
new BigDecimal("33.33") = 33.33
the split rejects the double-built value: percent for asha has more than 2 decimal places: 33.3299999999999982946974341757595539093017578125
2. 3000 dinners of Rs 100.00 between asha, bala and chitra
always the same order: asha Rs 100020.00, bala Rs 99990.00, chitra Rs 99990.00
rotating tie offset: asha Rs 100000.00, bala Rs 100000.00, chitra Rs 100000.00
3. asha pays Rs 600.00 for a gift but is not in the split
asha Rs 600.00
bala -Rs 300.00
chitra -Rs 300.00
4. default fraction digits: INR 2, JPY 0, KWD 3
5. an expense of Rs 0.01 split three ways
asha Rs 0.00
bala Rs 0.00
chitra Rs 0.00
debts: []
6. simplifying balances that do not add up to zero: balances do not add up to zero: the sum is Rs 0.01