Closed adamrogoyski closed 4 years ago
When rate=0.0, the sign on present value is wrong, causing most degenerate cases to be incorrect.
As an example, making periodic payments of $10 for a $100 loan at progressively smaller interest rates shows the number of periods approaching 10:
numpy.nper(0.01, -10, 100, 0) 10.588644459423231
numpy.nper(0.001, -10, 100, 0) 10.055360184319873
numpy.nper(0.0001, -10, 100, 0) 10.005503577667028
numpy.nper(0.00001, -10, 100, 0) 10.000550035678859
numpy.nper(0.000001, -10, 100, 0) 10.000055001142128
If the interest rate is 0%, it should be exactly 10 payments, not -10:
numpy.nper(0, -10, 100, 0) -10.0
A fix for this: https://github.com/numpy/numpy/pull/8515
When rate=0.0, the sign on present value is wrong, causing most degenerate cases to be incorrect.
As an example, making periodic payments of $10 for a $100 loan at progressively smaller interest rates shows the number of periods approaching 10:
numpy.nper(0.01, -10, 100, 0) 10.588644459423231
numpy.nper(0.001, -10, 100, 0) 10.055360184319873
numpy.nper(0.0001, -10, 100, 0) 10.005503577667028
numpy.nper(0.00001, -10, 100, 0) 10.000550035678859
numpy.nper(0.000001, -10, 100, 0) 10.000055001142128
If the interest rate is 0%, it should be exactly 10 payments, not -10:
numpy.nper(0, -10, 100, 0) -10.0