Bill rounding
Make product price scale a constant in Bill. We want to calculate all product prices with 4 decimal precision, just in case. And to make a reference quote for future generations: "This should be enough for everyone". We still want to display the price to users with scale 2, but the scaling should be done at the view level, after all calculations have been made.
This commit does not have any functional changes because all data going through database has scale set already to 4. This just makes the value constant and adds some comments to remind that the scale and rounding mode have real world impact..
By default BigDecimal has a huge scale, which causes BigDecimal to act like a float and these become true:
- new BigDecimal(555.55) -> 555.549999999999954525264911353588104248046875
- 55554 == new BigDecimal(555.55).multiply(new BigDecimal(100)).intValue();
-
Status changed to merged
Toggle commit list -
-
Please register or sign in to post a comment