[Numpy-svn] [numpy/numpy] 0b92be: BUG: IRR was returning nan instead of valid negati...

GitHub noreply at github.com
Sun Feb 2 00:10:41 EST 2014


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 0b92be65cc0063cabab6b9552df74788c4077e5b
      https://github.com/numpy/numpy/commit/0b92be65cc0063cabab6b9552df74788c4077e5b
  Author: Philip Eliot <git.peliot at gmail.com>
  Date:   2014-02-01 (Sat, 01 Feb 2014)

  Changed paths:
    M numpy/lib/financial.py
    M numpy/lib/tests/test_financial.py

  Log Message:
  -----------
  BUG: IRR was returning nan instead of valid negative answer.

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)




More information about the Numpy-svn mailing list