How can I know that, by adding y to x, x has crossed or arrived at an integer value dividable by i?
I might be using the wrong terminology, so let me explain with an example:
Say:
- we have an interval
i = 3 - we have a integer variable
y = 3 - we have a integer variable
xthat is the result ofx' + y, let's say the current value ofx = 5, so the previous value of xx' = 2
Because x went from 2 to 5, x crossed 3, so the condition should be true. The condition should be true whenever x crosses or arrives at the whole number 3 (i), 6 (2i), 9 (3i), 12 (4i), etc. The condition should be false when we do not cross or arrive at a whole number dividable by i (so when x goes from 3 to 5, condition should be false).
The condition I'm using now is (I'm using integer divisions which work as a floor):
floor(x / i) > floor((x - y) / i)
It works, but I have the feeling that it can be simplified. But the floor is making it hard for me. Any help would be appreciated.