Given the equation-> (index+rotation)%rot=f; if i konw the values of f , rotation , rot what is the formula to calculate index.I am not so good in mathematics but i want to know to calculate index in my programming.
Asked
Active
Viewed 120 times
0
-
`rot*k+f - rotation`, here k is a nonzero integer. – marmeladze Feb 02 '17 at 07:27
1 Answers
0
(index + rotation)%rot = f
means
index + rotation = rot*k + f, k is an integer (.., -2, -1, 0, 1, 2,..)
therefore
index = rot*k + f - rotation, k: integer
If you want to have index > 0
, make sure to choose k > (rotation - f) / rot

Linh Nguyen
- 1,120
- 7
- 13