You can't use that compound-angle formula
. . because is undefined.
Look at the timestamps on the replies by Soroban and TKH .... Soroban has actually given you the solution. And while he was giving it to you, TKH was typing a hint for you to think about.
The only thing that defies understanding here is why you are confused.