Algorithm Request: Comparison against a range that wraps


Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5973
Posted: 09:54am 25 Jun 2021      

  jirsoft said  
min(max(a,b)-min(a,b), WRAP+min(a,b)-max(a,b))
where WRAP is 360 for angle and 12:00 for time...


Couldn't put it any more compact...