galovics commented on code in PR #4314:
URL: https://github.com/apache/fineract/pull/4314#discussion_r1952784217


##########
fineract-core/src/main/java/org/apache/fineract/organisation/monetary/domain/MoneyHelper.java:
##########
@@ -33,7 +33,9 @@ public class MoneyHelper {
 
     private static RoundingMode roundingMode = null;
     private static MathContext mathContext;
-    private static final int PRECISION = 12;
+    public static final int PRECISION = 12;

Review Comment:
   Definitely we shouldn't use 24 precision in the code, that'll lead to very 
very hard to investigated bugs in the future. Either go with 19 (like the DB 
column) or smaller precision.



##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/LoanSchedulePeriodData.java:
##########
@@ -156,11 +158,13 @@ public static LoanSchedulePeriodData 
periodWithPayments(final Integer periodNumb
             final BigDecimal totalPaidLateForPeriod, final BigDecimal 
totalWaived, final BigDecimal totalWrittenOff,
             final BigDecimal totalCredits, final boolean isDownPayment, final 
BigDecimal totalAccruedInterest) {
 
-        BigDecimal totalDue = MathUtil.add(principalOriginalDue, interestDue, 
feeChargesDue, penaltyChargesDue);
-        BigDecimal totalOutstanding = MathUtil.add(principalOutstanding, 
interestOutstanding, feeChargesOutstanding,
+        final MathContext mc = new MathContext(MoneyHelper.PRECISION_16, 
MoneyHelper.getMathContext().getRoundingMode());

Review Comment:
   You mean in the rest of the codebase? If so, then I completely agree. We 
should go with 12 consistently everywhere.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to