Skip to content

Commit 7420dc8

Browse files
committed
ENH: npv: Cast input arrays to np.float64
At the moment we have only templated the Cython code to work with ``double``s. This may need to be changed in the future.
1 parent 75f03ae commit 7420dc8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numpy_financial/_financial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,8 @@ def npv(rate, values):
922922
[-2798.19, -3612.24],
923923
[-2884.3 , -3710.74]])
924924
"""
925-
values_inner = np.atleast_2d(values)
926-
rate_inner = np.atleast_1d(rate)
925+
values_inner = np.atleast_2d(values).astype(np.float64)
926+
rate_inner = np.atleast_1d(rate).astype(np.float64)
927927

928928
if rate_inner.ndim != 1:
929929
msg = "invalid shape for rates. Rate must be either a scalar or 1d array"

0 commit comments

Comments
 (0)