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

allocate() allocate remainder incorrectly #103

Open
hms5232 opened this issue Dec 14, 2023 · 0 comments · May be fixed by #104
Open

allocate() allocate remainder incorrectly #103

hms5232 opened this issue Dec 14, 2023 · 0 comments · May be fixed by #104

Comments

@hms5232
Copy link

hms5232 commented Dec 14, 2023

If the total to be allocated cannot be divided fully, it will add remainder to each ratio which in order.

For example, we need to divide $613 to participants with $98, $92, $98, $123, $102, $92. It will be:

98 => 100
92 => 94
98 => 99
123 => 124
102 => 103
92 => 93

but if we change the order of ratios to $123, $102, $98, $98, $92, $92:

123 => 125
102 => 104
98 =>99
98 =>99
92 => 93
92 => 93

This behaviour is not fair. The remainder should be allocated by ratio size, not order.

hms5232 added a commit to hms5232/rusty_money that referenced this issue Dec 16, 2023
@hms5232 hms5232 linked a pull request Dec 16, 2023 that will close this issue
hms5232 added a commit to hms5232/givememoney that referenced this issue Dec 24, 2023
暫時性的權宜之計

see varunsrin/rusty_money#103

If the PR has accepted and crate release new version,
i will revert this commit and upgrade crate to resolve this problem.
hms5232 added a commit to hms5232/rusty_money that referenced this issue May 9, 2024
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 a pull request may close this issue.

1 participant