[Numpy-svn] [numpy/numpy] 97917a: BUG: Fix zero divide warning in financial.pmt.

GitHub noreply at github.com
Tue Feb 17 19:11:20 EST 2015


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 97917ac8d45c54aa99453b350cd1834a121d1d29
      https://github.com/numpy/numpy/commit/97917ac8d45c54aa99453b350cd1834a121d1d29
  Author: Fei Liu <liufei11111 at hotmail.com>
  Date:   2015-02-17 (Tue, 17 Feb 2015)

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

  Log Message:
  -----------
  BUG: Fix zero divide warning in financial.pmt.

The pmt function in financial.py does a zero divide when rate=0 because
error because the alternatives in np.where() are evaluated befor the
selection is made.first before going into the function however, the
denominator can be zero at that time.

Closes #4701.


  Commit: a9a80fc4a5ed8fb2faba1e1102121468a905c908
      https://github.com/numpy/numpy/commit/a9a80fc4a5ed8fb2faba1e1102121468a905c908
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-02-17 (Tue, 17 Feb 2015)

  Changed paths:
    M numpy/lib/financial.py

  Log Message:
  -----------
  MAINT: Simplify fix for rate == 0 in financial.pmt.


  Commit: 97c481ee90459e8e372b74144f666cf06ad9df61
      https://github.com/numpy/numpy/commit/97c481ee90459e8e372b74144f666cf06ad9df61
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-02-17 (Tue, 17 Feb 2015)

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

  Log Message:
  -----------
  MAINT: Fix pmt test in numpy/lib/tests/test_financial.py.

The tests were using assert_almost_equal and setting the precision to 3
decimals. The reason for that low precision appears to have been the
failure of the tests for a more reasonable precision. The fix was to use
assert_allclose instead.


  Commit: 4338d11c104d867cf88d5ba2a87b032e58de7053
      https://github.com/numpy/numpy/commit/4338d11c104d867cf88d5ba2a87b032e58de7053
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-02-17 (Tue, 17 Feb 2015)

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

  Log Message:
  -----------
  Merge pull request #5577 from charris/cleanup-gh-5263

BUG: financial.pmt warns of zero divide when rate == 0.


Compare: https://github.com/numpy/numpy/compare/4065adbcc4e9...4338d11c104d


More information about the Numpy-svn mailing list