addaptic

Reference Arithmetic

lz_multiply

The product of two numbers.

long lz_multiply( CLZNumber* leftOperand, CLZNumber* rightOperand, CLZNumber* targetNumber = nullptr );

The product is worked from the exact digits and rounded once, in the target's own rounding mode. Past the smallest products the digits are packed into limbs; long products are split Karatsuba's way, and in base ten the largest are taken by a number-theoretic transform.

Examples

CallAnswer
lz_multiply( 99999999999999999999, 99999999999999999999 )9999999999999999999800000000000000000001
lz_multiply( 0.1, 0.1 )0.01
lz_multiply( 1.5, 1.5 ) base 122.3 base 12

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