Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 18, 2015

Conversation

charris
Copy link
Member

@charris charris commented Feb 17, 2015

Cleanup of #5263.

Correctly format commit message.
Simplify fix for rate == 0 in financial.pmt
Use assert_allclose in pmt tests to check with better precision.

liufei11111 and others added 3 commits February 17, 2015 13:12
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 numpy#4701.
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.
@jaimefrio
Copy link
Member

Doing your taxes? :-)

@charris
Copy link
Member Author

charris commented Feb 17, 2015

Thanks for the reminder :(

charris added a commit that referenced this pull request Feb 18, 2015
BUG: financial.pmt warns of zero divide when rate == 0.
@charris charris merged commit 4338d11 into numpy:master Feb 18, 2015
@charris charris deleted the cleanup-gh-5263 branch February 18, 2015 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants