Skip to content
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

MAINT: Avoid ZeroDivisionErrors in nper_inner_loop #119

Open
Kai-Striega opened this issue Apr 3, 2024 · 0 comments
Open

MAINT: Avoid ZeroDivisionErrors in nper_inner_loop #119

Kai-Striega opened this issue Apr 3, 2024 · 0 comments

Comments

@Kai-Striega
Copy link
Member

Proposed new feature or change:

I've just merged #118, this PR reproduced the behaviour of nper in Cython as closely as possible. However there are several ZeroDivisionErrors that are currently handled poorly (they return NANs).

z = pmt_ * (1.0 + rate_ * when_) / rate_
return log((-fv_ + z) / (pv_ + z)) / log(1.0 + rate_)

In each case, we should carefully evaluate each code path and return a financially sensible result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant