C
Christian Kruggel
Hi!
I try to do some basic programming and got stuck with the
modulo-operator an the problem how to shift any number n into the
interval [b;e] with b < 0 and e > 0.
My first approach was to calculate the spread of [b;e] by e - b and
then to calculate n % spread. Unfortunately this just works for
numbers that are already in [b;e] while other numbers smaller than b
and greater than e are not shifted correctly.
Has anybody programmed such calculation already and could give me a
helping hint?
Christian
I try to do some basic programming and got stuck with the
modulo-operator an the problem how to shift any number n into the
interval [b;e] with b < 0 and e > 0.
My first approach was to calculate the spread of [b;e] by e - b and
then to calculate n % spread. Unfortunately this just works for
numbers that are already in [b;e] while other numbers smaller than b
and greater than e are not shifted correctly.
Has anybody programmed such calculation already and could give me a
helping hint?
Christian