samedi 25 avril 2015

Objective C IRR calculation compared to Excel IRR function


The discussion below provides codes in Objective C IRR calculation that is consistently incorrect when compared to Excel IRR function. Does anyone know why there is such a difference?

The code used is offered in this previous discussion:

Calculate IRR (Internal Rate Return) and NPV programatically in Objective-C

The test cash flow I am using to calculate the IRR is the following: "Print tempCashFlow: ( "-5099701.25", "-22503.796875", "-22503.79296875", "-22503.79296875", "-20907.26171875", "-17899.7421875", "-17899.7421875", "-17899.7421875", "-14660.69140625", "-12447.80078125", "-12447.796875", "-12018.1640625", "-5991.81640625", "-5991.81640625", "-5991.81640625", "-2885.875", "1653.125", "1653.125", "1653.125", "8307.328125", "11110408.45703125" )

The above temporary cash flow contains quarterly figures over a 5-year period (i.e. 20 periods plus the time zero period... so 21 figures in the cash flow).

The code delivers 15.2% IRR instead of circa 16.0% produced by Excel IRR function. I also tested it manually, and I believe 16% is the correct answer. Can anyone help understand what may be wrong with the code? I cannot see any issues. It also appears to be identical to code promoted on this link as well:

http://ift.tt/1IXyoR7

PS: I've also noticed that the margin of error increases dramatically if I reduce the cash flow to a 2-year period instead of a 5-year period (e.g. something like 35% (incorrect) versus 45% IRR (correct answer)


Aucun commentaire:

Enregistrer un commentaire