Talk:Mutsuki/@comment-16545476-20150422172808/@comment-24332640-20150423083255

The problem is the rounding. There isn't actually enough information to make a definitive claim with only two points because the rounding actually creates ambiguity.

In the absence of rounding two points would uniquely determine a line. If you have (level1, val1) (level2, val2) the slope is (val2-val1)/(level2-level1) and the intercept (aka minimum) is val1 - level1*(val2-val1)/(level2-level1) or val2 - level2*(val2-val1)/(level2-level1) (either one). And the max is just 99*slope + min.

Now in the case of rounding there's actually a range of levels that give a particular value. You measure (level1, val1) (level2, val2) but the 'true' value for a given level is somewhere between the measured value val1 and val1+1 (not inclusive) because it's always rounded down. So you could make two lines for the worst case scenario:

minslope = (val2-val1-1)/(level2-level1)

maxslope = (val2-val2+1)/(level2-level1)

minval = minslope * 99 + (val1 - level1*maxslope)

maxval = maxslope * 99 + (val1 - level1*minslope)

So that gives you a range. Obviously it's better when the points are further apart. And if you have more than 2 points you can start getting more sophisticated. But you can't gives a definite answer with only two points thanks to rounding...