I have three values that should in total come to 100 at all times
the user can only change one value at a time (by increments think slider it might not be single increments at a time)
when one value changes I want the others to also change to reflect the constant total, however on a pro rata basis
The larger of the other two values should increase more than the smaller value
but should decrease less than the smaller value
Not sure what you mean by “but should decrease less than the smaller value” – this seems to indicate it’s not pro-rata, especially if the ratios are maintained only in one direction.
Assuming that’s a mistake, the way to pro-rata the non-moving values
bandcis simply to maintain their ratio when the moving valueachanges, something like:You can see there that the ratio remains the same between
bandc(30:20and24:16are both3:2), at least until the values get small enough for rounding errors to come into play (reducing them, then increasing them may not give you back the exact values you started with).If that’s important, you could consider using floating point for the values and simply turn them into integers as a final step.