The 180° Error: Why arctan(b/a) Flips Your Impedance
arctan of a ratio cannot tell 3 + j4 from −3 − j4. That single-argument shortcut turns inductive loads capacitive and sends matching networks in the wrong direction. Here is why atan2 exists.
Contents
Two numbers, same ratio
Take and . They point in opposite directions in the complex plane. Now compute the ratio for each:
- 4 / 3 = 1.333
- (−4) / (−3) = 1.333
Identical. Every bit of information distinguishing those two vectors was destroyed by the division, because the two minus signs cancelled.
So returns for both. One of those answers is right and the other is off by exactly .
What the single-argument form can and cannot do
takes one number and returns an angle between −90° and +90°. That range covers half the plane — quadrants I and IV. It has no way to reach quadrants II and III, because no ratio maps there.Given a point in quadrant II, arctan reports the quadrant IV mirror. Given a point in quadrant III, it reports the quadrant I mirror.
takes the two components separately, so the signs survive. It inspects them and returns the correct angle over the full −180° to +180° range:- 3 + j4 → 53.1301°
- −3 + j4 → 126.8699°
- −3 − j4 → −126.8699°
- 3 − j4 → −53.1301°
All four have magnitude 5. Only the angle tells them apart, and only atan2 gets it right.
Why this bites in RF specifically
An impedance is . In polar form it is , and the sign of carries the entire physical meaning:
- : inductive
- : capacitive
- : resistive
Get the quadrant wrong and an inductive load reads as capacitive. A matching network designed from that reading adds the wrong element — series inductance where the load already had too much, or shunt capacitance where the load needed the opposite. The match gets worse, and it gets worse in a way that looks like a component tolerance problem rather than a sign error.
For a passive load with , the point is in quadrant I or IV, where arctan happens to be correct. That is why the bug survives so long: passive impedances hide it. It surfaces the moment you handle a reflection coefficient, where the real part is routinely negative, or an active device with negative resistance, or a de-embedded measurement that swung past the imaginary axis.
The convention question
atan2 returns −180° to +180°. Many instruments and file readers present 0° to 360° instead. The two are the same angle; negative results differ by exactly .
That becomes a real problem when you compare or average. The mean of 179° and −179° is 0° by arithmetic and 180° in reality. Any averaging, interpolation, or curve fit across the wrap point needs the phase unwrapped first — a step that gets skipped constantly in measurement post-processing.
Which convention you use is a choice. Not knowing which one your data is in is not.
Touchstone formats
S-parameter files store the same complex numbers three ways, declared on the option line:
- MA — magnitude and angle in degrees
- DB — magnitude in dB and angle in degrees
- RI — real and imaginary parts
RI needs no conversion at all. MA and DB need the polar-to-rectangular step before any arithmetic that is not pure multiplication. Reading a DB file as if it were MA gives magnitudes wrong by a logarithm — a mistake that produces plausible-looking but entirely wrong plots.
Habits worth having
Use atan2 always. There is no case where the single-argument form is safer, and it costs nothing. Round-trip anything suspicious. Convert to polar, convert straight back, compare with the original. A quadrant error shows up immediately as a sign flip; a units error shows up as a scale factor. Read the angle sign before the magnitude when looking at an impedance. It tells you which direction to move before any arithmetic. Keep full precision through cascades. Rounding 53.13010235° to 53.1° looks harmless and accumulates into visible magnitude error after a handful of chained multiplications. Treat a negative magnitude as an error, not a result. A magnitude of −r describes the same vector as +r rotated by 180°, and downstream tools that assume a non-negative magnitude will misread it.The rectangular to polar converter runs both directions at once with atan2, and reports the angle in radians, in , and in to so you never have to add or subtract 360 by hand.
Related Articles
Angle Conversions in RF Electronics: Why Units Matter
Convert angles between degrees, radians, gradians, arcminutes, and arcseconds. Essential for antenna pointing, phase calculations, and servo control.
Jul 20, 2026
Unit ConversionConverting Energy Units: Electron-Volts to Kilowatt-...
Convert between joules, electron-volts, kWh, calories, and BTU for real engineering work. Practical guide with ESD, battery, and semiconductor examples.
Jul 20, 2026
Unit ConversionConverting Lux to Foot-Candles: Easy Illuminance Guide
Learn to convert between lux, foot-candles, phot, and other illuminance units. Practical examples for sensor calibration and optical design.
Jul 20, 2026