diff options
Diffstat (limited to 'numpy/lib/financial.py')
-rw-r--r-- | numpy/lib/financial.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/numpy/lib/financial.py b/numpy/lib/financial.py index 0be12f2c7..8cac117c9 100644 --- a/numpy/lib/financial.py +++ b/numpy/lib/financial.py @@ -266,14 +266,11 @@ def nper(rate, pmt, pv, fv=0, when='end'): (rate, pmt, pv, fv, when) = map(np.asarray, [rate, pmt, pv, fv, when]) use_zero_rate = False - old_err = np.seterr(divide="raise") - try: + with np.errstate(divide="raise"): try: z = pmt*(1.0+rate*when)/rate except FloatingPointError: use_zero_rate = True - finally: - np.seterr(**old_err) if use_zero_rate: return (-fv + pv) / (pmt + 0.0) |