Fix dynamic rate step bracketing interval #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Hey there! 👋
In this PR, there was a precision issue we were having in the
find_bracketing_interval
function when searching for bracketing intervals at very large rates. Originally, the max rate was capped at 10.0, but we've now increased that to 1E300. The fixed step size approach wasn't cutting it, leading to floating-point precision problems as the rate got larger.To address this, I introduced a dynamic step size that adjusts as the rate increases. This allows us to explore higher values effectively (all the way up to 1E300!) without running into precision issues. The new approach uses a logarithmic-like step, ensuring better coverage and stability across the entire range.
Changelog
find_bracketing_interval
function now supports extremely high rates, improving precision for very high XIRRs (over 1E300%). Dynamic step sizing ensures accurate results even at extreme rates.QA
Now the extremely good investment converges in the specs: