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

Adopt banker's rounding for interest calculations #4573

Closed
turadg opened this issue Feb 17, 2022 · 0 comments · Fixed by #5233
Closed

Adopt banker's rounding for interest calculations #4573

turadg opened this issue Feb 17, 2022 · 0 comments · Fixed by #5233
Assignees
Labels
Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request restival to be done before RUN Protocol Purple Team festival
Milestone

Comments

@turadg
Copy link
Member

turadg commented Feb 17, 2022

What is the Problem Being Solved?

As yet we have two rounding methods for integer division (ceil and floor). Because of the repeated division operations in how #4527 tracks compounded interest, those strategies produce measurable skew.

Description of the Design

A rounding strategy without bias toward/away from zero is Round half to even. (It is also free of positivity/negativity bias, which isn't relevant to interest calculation but would have other applications.)

This strategy is also known as bankers' rounding and is the default rounding mode used in IEEE 754 operations for results in binary floating-point formats.

Security Considerations


Test Plan


@turadg turadg added Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request labels Feb 17, 2022
@turadg turadg self-assigned this Feb 17, 2022
@Tartuffo Tartuffo added the restival to be done before RUN Protocol Purple Team festival label Mar 10, 2022
@Tartuffo Tartuffo added this to the Mainnet 1 milestone Mar 23, 2022
@mergify mergify bot closed this as completed in #5233 Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Economy OBSOLETE in favor of INTER-protocol enhancement New feature or request restival to be done before RUN Protocol Purple Team festival
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants