You only need the difference of both values.

abs() gives you always the positive value, independently of the sign of your value.

"speedX = abs(my.pan - copy); "