Algorithm Request: Comparison against a range that wraps


Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5994
Posted: 09:48pm 24 Jun 2021      

To determine the difference, you subtract a from b
To determine the difference in a case a wrap: add full range to b.
Then subtraxt
Then take modulus range