For starters, in the region $\displaystyle \displaystyle \pi < \theta < \frac{3\pi}{2}$, you should know that $\displaystyle \sin{\theta} < 0,\cos{\theta} < 0$ and $\displaystyle \tan{\theta} > 0$.
So check your starting values of $\displaystyle \sin{\theta}$ and $\displaystyle \cos{\theta}$.