http://pastie.org/144919
I just wrote it this morning in 15 min. or so, using the trial-and-error model. It can find the IRR for 100 cash flows to 9 decimal places in about 23ms on my 17" MacBook Pro.
Note that this algorithm is O(n^2), i.e. doubling the length of the input array will roughly quadruple the computation time.
EDIT: Ack! Wait, don't use this. It only goes up to 100%. IRR can go past...
Leave a comment: