[I am also cross posting to functional to get clarification on rounding
rule sepcification mentioned in
 
http://www.mifos.org/knowledge/functional-specs/accounting-in-mifos#currency
-and-rounding-rules 



> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Adam Monsen
> Sent: Thursday, January 17, 2008 7:35 AM
> To: Mifos Developer Mailing List
> Subject: SPAM-LOW: [Mifos-developer] Rounding Rules Questions
> 
> 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.

[soham] Thanks. I will look into this.

> 
> > 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.

[soham] I agree. In any case, it seems applyRounding is trying to implement
a business logic but I am doubting whether its being done correctly. As I
test this more I will share my findings. 

> 
> 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.

[soham] Yes, it looks like that's how it is implemented currently. 

> [...]
> > "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)..
> 

[soham]Perhaps PMs can shed some light on this, i.e. how should the above
mentioned rule apply for different rounding options. 


> 
> > 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

[soham] Yes, it seems to have worked for me for now

> --
> 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/


-------------------------------------------------------------------------
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/
_______________________________________________
Mifos-functional mailing list
Mifos-functional@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mifos-functional

Reply via email to