addaptic

Reference Complex arithmetic

lzc_multiply

The product of two complex numbers.

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

(a + bi)(c + di) is (ac − bd) + (ad + bc)i, each part worked from exact products and rounded once, in that target part's own rounding mode, so i × i is exactly −1.

Examples

CallAnswer
lzc_multiply( 1 + 2i, 3 + 4i )−5 + 10i
lzc_multiply( 0 + 1i, 0 + 1i )−1 + 0i

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