Skip to content

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

Open
jxjjligang wants to merge 2 commits into
ebradyjobory:masterfrom
jxjjligang:master
Open

IRR improvement: use [binary search] idea to improve both performance and [result value range].#49
jxjjligang wants to merge 2 commits into
ebradyjobory:masterfrom
jxjjligang:master

Conversation

@jxjjligang

Copy link
Copy Markdown

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

jxjjligang commented Jun 29, 2020

Copy link
Copy Markdown
Author

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