Skip to content

Conversation

@Jamiras
Copy link
Member

@Jamiras Jamiras commented Nov 11, 2025

When combining values, they're automatically promoted to the most permissive data type (float is preferred over integer if either operand is a float), but the accumulator type is fixed by the first thing stored in it. So if the accumulator is an integer and a float value is subtracted, the accumulator was being changed into a float, the subtraction was performed, then the result was turned back into an integer to store in the accumulator.

Because subtracting a decimal value results in another decimal value slightly lower than if only the whole part was subtracted, forcing that result back to an integer results in a value one lower than if the integer conversion had occurred before the subtraction.

Given the expression:

    (int)(18 - 17.5)

If multiple coercions occur, the result is 0:

    (int)((float)18 - 17.5) => (int)(0.5) => 0

But if the coercion only appies to the modifier, the result is 1:

    18 - (int)17.5 => 18 - 17 => 1

Given the way the accumulator functions, I think the coercion should only be applied to the modifier.

This is also consistent with rcheevos prior to 12.0. More information is here: https://discord.com/channels/476211979464343552/1437468039162630244/1437589445355503717

@Jamiras Jamiras added this to the 12.2.0 milestone Nov 11, 2025
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.

1 participant