numpy/numpy — pull request #4253 by peliot (2014-02-01 17:55:22+00:00)
Title: BUG: IRR was returning nan instead of valid negative answer, and returni...

...ng array instead of float

This change corrects the following two bugs in numpy.irr:
* When the solution was negative, numpy.irr returned nan instead of the correct solution because of the mask applied to the roots. Corrected by removing the mask that 0 < res < 1.
* When multiple roots were found, numpy.irr was returning an array of all roots rather than a single float. This bug was corrected by selecting the single root closest to zero (min(abs(root)).

With these corrections, numpy.irr returns the same result as the corresponding spreadsheet function in LibreOffice Calc for all test cases (additional test cases were added to cover cases with multiple positive and negative roots)