addaptic

Reference Complex arithmetic

lzc_add

The sum of two complex numbers.

long lzc_add( CLZComplex* leftOperand, CLZComplex* rightOperand, CLZComplex* targetNumber = nullptr );

Each part is the sum of the parts, exact unless it has more places than the working precision, when it is rounded in that target part's own rounding mode. A right operand in another base is brought into the left's exactly. A value whose two parts are in different bases is refused, kBaseMismatch, both parts of the answer a not-a-number.

Examples

CallAnswer
lzc_add( 1 + 2i, 3 − 5i )4 − 3i
lzc_add( 0.1 + 0.2i, 0.2 + 0.1i )0.3 + 0.3i

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_subtract The difference of two complex numbers, left minus right.
  • lz_add The sum of two numbers.