Skip to content

numpy.nper() with pmt=0 gives unexpected "divide by zero" warning #18

@OlehOnyshchak

Description

@OlehOnyshchak

Reproducing code example:

import numpy as np

np.nper(rate=0.1, pmt=0, pv=-500, fv=1500)

Error message:

numpy\lib\financial.py:308: RuntimeWarning: divide by zero encountered in long_scalars
A = -(fv + pv)/(pmt+0)

Actual Result:

np.nper() returns the correct result with "divide by zero" warning

Expected Result:

np.nper() returns the same correct result but without warning

Numpy/Python version information:

1.16.4 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions