I ran a few tests. This seems to work. You might want to test it more.
rem even rotate
rem by latch
rem 12/30/2008
sync on
make object cube 1,25
do
cur#=object angle y(1)
dest#=rnd(360)
repeat
cur#=wrapvalue(cur#+even_rotate(cur#,dest#,4.0))
if abs(dest#-cur#) < 4.5
cur#=dest#
endif
yrotate object 1,wrapvalue(cur#)
text 0,0,"Inside while loop"
text 0,20,str$(abs(dest#-cur#))
text 0,40,str$(cur#)
text 0,60,str$(dest#)
sync
until cur#=dest#
sync
loop
function even_rotate(cur#,dest#,angstep#)
angstep#=abs(angstep#)
if (cur# >= 0 and cur# < 90) and (dest# >= 270 and dest# < 360)
angstep#=0-angstep#
endif
if (cur# >= 0 and cur# < 180) and (dest# < cur#)
angstep#=0-angstep#
endif
if (cur# >= 180 and cur# < 360) and (abs(dest#-cur#)<=180) and (dest# < cur#)
angstep#=0-angstep#
endif
endfunction angstep#
Enjoy your day.