addaptic

Reference Complex arithmetic

lzc_arg

The argument of a complex number, its angle, a real answer in the thread's angle unit.

long lzc_arg( CLZComplex* leftOperand, CLZNumber* targetNumber );

The angle of z from the positive real axis, in (−π, π], or (−180°, 180°], correctly rounded in the thread's unit; the argument of nought is nought. It is lz_arctangent2 of the imaginary part over the real one.

The answer is real, so the target is a CLZNumber, and it is required. A not-a-number, or the point at infinity, has no angle and answers a not-a-number.

Examples

CallAnswer
lzc_arg( 1 + 1i )0.785398163397448309615660845819875721
lzc_arg( 1 + 1i ) degrees45
lzc_arg( −1 + 0i ) degrees180
lzc_arg( 0 + 0i )0

Each answer is what Addaptic printed for the call, in radians, at 36 places unless a setting is shown.

Returns

kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.

See also

  • lzc_abs The modulus of a complex number, |z|, a real answer.
  • lzc_polar A complex number from its modulus and its angle, r cos θ + i r sin θ.
  • lz_arctangent2 The angle of the point (x, y), with y first, as C's atan2 takes them.