In this question, it is shown that
$$A \sin(x) + B \cos (x) = R \sin ( x + \theta )$$
for $A,B$ real and positive, with
$$R = \sqrt{A^2 + B^2}$$
$$\theta = \arctan \left( \frac{B}{A} \right)$$
This is performed solving the system
$$\left\{ \begin{array}{c} R \cos (\theta) = A\\ R \sin (\theta) = B \end{array} \right. $$
for $R$ and $\theta$. What if, instead, $A$ and/or $B$ are real, but not positive?
Some trivial test on WolframAlpha shows that the $\arctan \left( \frac{B}{A} \right)$ term is computed the same way, considering the sign of $A$ and $B$.
$R$ is instead negative if $A$ or both $A$ and $B$ are negative. It is obtained by squaring and summing the two equations in the system and I can't figure out how a sign can be considered in this operation.