We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8583586 commit 5b134acCopy full SHA for 5b134ac
numpy_financial/_cfinancial.pyx
@@ -13,12 +13,16 @@ cdef double nper_inner_loop(
13
return INFINITY
14
15
if rate_ == 0.0:
16
- return -(fv_ + pv_) / pmt_
+ with cython.cdivision(True):
17
+ # We know that pmt_ != 0, we don't need to check for division by 0
18
+ return -(fv_ + pv_) / pmt_
19
20
if rate_ <= -1.0:
21
return NAN
22
- z = pmt_ * (1.0 + rate_ * when_) / rate_
23
24
+ # We know that rate_ != 0, we don't need to check for division by 0
25
+ z = pmt_ * (1.0 + rate_ * when_) / rate_
26
return log((-fv_ + z) / (pv_ + z)) / log(1.0 + rate_)
27
28
0 commit comments