Closed IcanMorris closed 5 years ago
Negative O-values flip the result:
7 is the desired encoded value, the random O-value part is 10, s resolved negative
s = -1 o = 10 * -1 v = -10 + 7 => -3
(-3 - (-10)) -1 ( 7 ) -1 => -7
The desired value also needs to be multiplied by s:
s = -1 o = 10 -1 v = -10 + (7 -1) => -17
(-17- (-10)) -1 ( -7 ) -1 => 7
NIce catch, I had noticed something was going wrong but didn't have time to check the maths. I should've done unit tests there too :) Thanks
Negative O-values flip the result:
7 is the desired encoded value, the random O-value part is 10, s resolved negative
s = -1 o = 10 * -1 v = -10 + 7 => -3
(-3 - (-10)) -1 ( 7 ) -1 => -7
The desired value also needs to be multiplied by s:
s = -1 o = 10 -1 v = -10 + (7 -1) => -17
(-17- (-10)) -1 ( -7 ) -1 => 7