0

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.

user1438832
  • 493
  • 3
  • 10

1 Answers1

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