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

Rounding improvement for budget model with iterations > 1 #1450

Merged
merged 6 commits into from
Sep 6, 2024

Conversation

jayz22
Copy link
Contributor

@jayz22 jayz22 commented Aug 28, 2024

What

This is a simple improvement to the rounding of budget model evaluation, when the model is linear and iteration > 1.

Current: 1. evaluates the linear equation, 2. scale the result back, then 3. multiply by iteration.
This change: 1. evaluates the linear equation, 2. multiply by iteration 3. scale the result back.

The latter results in less rounding and better precision when the iteration count is large.
Also added a test to illustrated expected behavior.

Why

[TODO: Why this change is being made. Include any context required to understand the why.]

Known limitations

[TODO or N/A]

@jayz22 jayz22 changed the title Rounding improvement for budget model with iterations Rounding improvement for budget model with iterations > 1 Aug 28, 2024
@jayz22 jayz22 changed the title Rounding improvement for budget model with iterations > 1 Rounding improvement for budget model with iterations > 1 Aug 28, 2024
Copy link
Contributor

@sisuresh sisuresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention this in CAP-0059?

soroban-env-host/src/budget/model.rs Outdated Show resolved Hide resolved
@jayz22
Copy link
Contributor Author

jayz22 commented Sep 6, 2024

Should we mention this in CAP-0059?

yeah I'll mention that in the CAP

@graydon graydon added this pull request to the merge queue Sep 6, 2024
Merged via the queue into stellar:main with commit 750827f Sep 6, 2024
12 checks passed
@graydon graydon deleted the budget_model branch September 6, 2024 19:49
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.

3 participants