Skip to content

BUG: rate returning incorrect value #126

@jestover

Description

@jestover

Describe the issue:

I found a situation where npf.rate is not returning the same thing as my BA II Plus financial calculator or npf.irr. Even setting guess to the correct value does not get the expected answer.

Reproduce the code example:

import numpy_financial as npf
# This returns -1.8964420585461792
npf.rate(8, -440_000, 263_175, 25_500) 
# This returns 0.5838779110248231 - Matches financial calculator
npf.irr([-440_000, 263_175, 263_175, 263_175, 263_175, 263_175, 263_175, 263_175, 263_175 + 25_500])
# Still returns -1.8964420585461792
npf.rate(8, -440_000, 263_175, 25_500, 0, 0.5838779110248231)

Error message:

No response

Runtime information:

print(numpy.version)
1.26.4
print(sys.version)
3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]
print(numpy.show_runtime())
WARNING: threadpoolctl not found in system! Install it by pip install threadpoolctl. Once installed, try np.show_runtime again for more detailed build information
[{'numpy_version': '1.26.4',
'python': '3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 '
'(clang-1500.3.9.4)]',
'uname': uname_result(system='Darwin', node='HCOB-003406.local', release='23.4.0', version='Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020', machine='arm64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP'],
'not_found': ['ASIMDFHM']}}]
None

Context for the issue:

No response

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