addaptic

Reference Complex arithmetic

lzc_abs

The modulus of a complex number, |z|, a real answer.

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

√(a² + b²), correctly rounded from the exact sum of the squares. The answer is real, so the target is a CLZNumber, and it is required: kFailed if null.

Examples

CallAnswer
lzc_abs( 3 + 4i )5
lzc_abs( 1 + 1i )1.414213562373095048801688724209698079

Each answer is what Addaptic printed for the call, 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_arg The argument of a complex number, its angle, a real answer in the thread's angle unit.
  • lzc_polar A complex number from its modulus and its angle, r cos θ + i r sin θ.
  • lz_abs The absolute value.