Objective C IRR calculation compared to Excel IRR function -


the discussion below provides codes in objective c irr calculation consistently incorrect when compared excel irr function. know why there such difference?

the code used offered in previous discussion:

calculate irr (internal rate return) , npv programatically in objective-c

the test cash flow using calculate irr 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 on 5-year period (i.e. 20 periods plus time 0 period... 21 figures in cash flow).

the code delivers 15.2% irr instead of circa 16.0% produced excel irr function. tested manually, , believe 16% correct answer. can understand may wrong code? cannot see issues. appears identical code promoted on link well:

http://www.codeproject.com/tips/461049/internal-rate-of-return-irr-calculation

ps: i've noticed margin of error increases dramatically if reduce cash flow 2-year period instead of 5-year period (e.g. 35% (incorrect) versus 45% irr (correct answer)

the irr series of cash flows reported excel's irr function 3.803961% (but assumes annual cash flows). c algorithm reference returns 3.803961%, well. so, there no discrepancy between these 2 calculated values. , if apply rate sum npv of of annual cashflows, zero, verifying 3.803961% correct irr.

you haven't shared how you're using either excel irr or function's handle quarterly cash flows, suspect may multiplying c function's resulting value four, not correct. have apply quarterly compounding it. if former, reproduce incorrect value of 15.215842%, if latter, correct value, 16.106276%. and, again, verifying calculating cumulative npv of these cash flows, zero, confirming 16.1% correct irr series of quarterly cash flows.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -