News

This is not a programming problem, the problem is that you do not know about trig functions. The tangent function is discontinuous in PI/2 + n*PI, so you should break it to pieces at those intervals.