That Can’t Be Right!

My movement algorithm seems to be a bit… wrong. Its collision resolution code SHOULD put my little ugly character on TOP of the line, but, clearly, it is doing the wrong thing:Wrong
Math is usually so nice to me! Somehow, I forgot all my trig, all my algebra, and everything else when the theme was announced.

EDIT: Oh, you two-faced square root function! Giving me the root that hangs Mr. Smiley-yellow-1-minute-in-GIMP from his head.