Files
java-interview-lab/splitwise/output/07-pitfalls.txt
T

26 lines
985 B
Plaintext

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