On Sun, 2007-12-16 at 16:08 +0545, Soham Dhakal wrote:
[...] 
> I implemented code to divide the Principal into equal installments, and
> calculate interest.

I'm not familiar with Equal Principle Payments, but here's a spreadsheet
that shows current rounding error for flat interest calculations:

http://rapidshare.com/files/84396603/Loan_Discrepancies.ods
SHA-1 checksum: f01feb8716d4c4a9215faab78c52bba66f6893bf

The "rounding to tenths" column shows the effect of mid-calculation when
figuring out loan interest. Filling out a spreadsheet like this to check
your calculations against what Mifos generates might be helpful in
figuring out what's going on.

It's in OpenOffice.org format.

> However there is a function in LoanBO->applyRounding
> which is adding some amount to the principal. For e.g. I had 15,000 pricipal
> and 24 installments with 2 weeks as frequency and for the first payment the
> principal should be (15000/24)=625, and the interest should be 144.23.
> But after going through applyRounding it comes to 625.8 and 144.2 

I wouldn't assume that applyRounding() is working correctly for what you
want to do. For instance, note that every time Money.add() or
Money.subtract() is called from applyRounding(), BigDecimal.setScale()
is used to re-scale the actual amount prior to obtaining a complete
result. Perhaps this is a bug since I would expect high precision to be
maintained throughout the calculation, and rounding to be performed just
before returning a value.

Also, looks like AccountingRules.DigitsAfterDecimal is used for the
scale. I feel like this might be a bug. I assumed
AccountingRules.DigitsAfterDecimal was only for display purposes.

[...]
> "The system should adjust the last installment (increase or decrease) for
> loan accounts to account for the amount change due to rounding. Example, if
> the actual repayment due = 181.95 and after rounding it becomes= 181, system
> should add the 0.95 to the last installment due."
> 
> Does this mean only the LAST installment should be adjusted? Because it
> looks like each installment was being adjusted (now this could be because I
> did not know how to set the rounding configuration properly).. 

I don't know.

> 3. Other than the functional specs, is there documentations on how to
> configure this or what the values mean? (I understand that there is a new
> and improved configuration process coming out of 1.1) 

Hopefully Kim answered all the configuration questions.

-- 
Adam Monsen


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Reply via email to