Your velocity function looks something like $v(t)=-\cos(t)-at+C$. Deriving that to get back to acceleration would give you $a(t)=\sin(t)-a$. If your original acceleration function is exactly centered around the $x$-axis, then $a$ should be $0$ and your velocity function wouldn't slope downwards. Computer precision error?