Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRR improvement: use [binary search] idea to improve both performance and [result value range]. #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jxjjligang
Copy link

The current IRR function has 2 problems that I noticed.

  1. It uses linear increment/decrement iteration to approach the result, which is both time consuming and can't guarantee a result returned.
  2. The boundary of the result rate is not clear to external user.

My code change will fix above problems.

  1. Binary search will greatly reduce CPU time and guarantee get a result.
  2. The boundary of the result rate is [-99.999%, 10000%], will be enough for most real world scenarios.

@jxjjligang
Copy link
Author

jxjjligang commented Jun 29, 2020

I have also run "npm test", which passed all the cases.
The IRR function result is exactly the same after my change.

@jxjjligang jxjjligang marked this pull request as draft July 3, 2020 16:10
@jxjjligang jxjjligang marked this pull request as ready for review July 30, 2020 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant