I'm currently looking for working and accurate implementations of Excel's RATE()
and IRR()
. I am coding in Javascript targeting modern browsers and Ruby 2.0.0 within Rails 4. My goal is to be able to calculate APR within a responsive Javascript application with a Rails back-end.
I've looked at and rejected the following options:
Finance Gem: No RATE()
function. IRR()
appears to hang for many test vectors.
Formula.js: No working RATE()
function. IRR()
does not work for many test vectors.
PHPExcel: Has a working RATE()
function that I converted to Ruby. This failed to work exactly like the PHP version and failed for important test vectors. This likely does have an IRR()
function but I have not yet tested it. I am not hopeful that I will find one that works but I will test it regardless.
I'm not interested in writing my own implementation from mathematical formulas. I prefer code that appears to have been soundly tested.
Update:
I have found a procedure for performing IRR()
using R that may be accurate enough for our purposes: https://stat.ethz.ch/pipermail/r-help/2008-August/169619.html I will evaluate this solution over the next day or so and update my question if I feel satisfied by it.