I've done similar code in a different context.Usually there are a lot of problems when you're
using cos/sin with absolute values as well as switching between positive and negative manually(by mulitplying by *-1). The reason is what you just said. absolute values ONLY accept positive values(in your case it's only negative values I believe because you multiplied by *-1)
Also, you should look at"maths and trigonometry cheat sheet for 2D and 3D games" online.The list contains the majority of math equations needed for practically everything (I believe it's on github.)
Also, you're using the clamp function. The clamp functions uses these parameters (value,upper bound,lower bound) The value will be between upper and lower bound. THAT ALMOST always has problems with abruptness in cases like these. You're "clamping" between 2 points(an analogy is an oyster clamping a pearl in it's mouth)
You should definitely use r0jhound's method.
Just curious, what game are you making?