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

Perform rounding to Precision in BindableNumber on decimal to avoid rounding error accumulation #6249

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Apr 16, 2024

RFC. Closes ppy/osu#27847.

Didn't really benchmark this as I consider it a basic correctness issue, but will do on request. Game-side units tests pass.

@peppy peppy self-requested a review April 16, 2024 20:46
@peppy peppy merged commit 49cff82 into ppy:master Apr 16, 2024
19 of 21 checks passed
@bdach bdach deleted the bindable-number-rounding-on-decimal branch April 17, 2024 05:40
bdach added a commit to bdach/osu that referenced this pull request May 28, 2024
Compare: ppy#26616

This came up elsewhere, namely in
ppy#28277 (comment).

As it turns out, at least one beatmap among those whose scores had
unexpected changes in total score, namely
https://osu.ppy.sh/beatmapsets/971028#fruits/2062131, was using slider
velocity multipliers that were not a multiple of 0.01 (the specific
value used was 0.225x). This meant that due to the rounding applied to
`SliderVelocityMultiplierBindable` via `Precision`, the raw value was
being incorrectly rounded, resulting in incorrect conversion.

The "direct" change that revealed this is most likely
ppy/osu-framework#6249, by the virtue of
shuffling the `BindableNumber` rounding code around and accidentally
changing midpoint rounding semantics in the process. But it was not
at fault here, as rounding was just as wrong before that change
as after in this specific context.
TextAdventurer12 pushed a commit to TextAdventurer12/osu that referenced this pull request Jul 6, 2024
Compare: ppy#26616

This came up elsewhere, namely in
ppy#28277 (comment).

As it turns out, at least one beatmap among those whose scores had
unexpected changes in total score, namely
https://osu.ppy.sh/beatmapsets/971028#fruits/2062131, was using slider
velocity multipliers that were not a multiple of 0.01 (the specific
value used was 0.225x). This meant that due to the rounding applied to
`SliderVelocityMultiplierBindable` via `Precision`, the raw value was
being incorrectly rounded, resulting in incorrect conversion.

The "direct" change that revealed this is most likely
ppy/osu-framework#6249, by the virtue of
shuffling the `BindableNumber` rounding code around and accidentally
changing midpoint rounding semantics in the process. But it was not
at fault here, as rounding was just as wrong before that change
as after in this specific context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certain float settings are saved weirdly in the editor
2 participants