I have come across a puzzling issue when using arctan2 in Numpy. Searching for atan2 errors did not answer the question, but someone might know the reason for this.
f = np.arange(0,100)
w = 2*np.pi*f/50
x = np.arctan2(sin(-w*d/2)*cos(w*d/2), cos(w*d/2)*cos(w*d/2))
gives different results to
f = np.arange(0,100)
w = 2*np.pi*f/50
x = np.arctan2(sin(-w*d/2), cos(w*d/2))
The former is out by an offset of $pi$ every period. Looks like a numeric issue but I have not seen any notes on this particular case.