addaptic

Reference Arithmetic

lz_add

The sum of two numbers.

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

The sum is exact unless it has more places than the working precision, when it is rounded in the target's own rounding mode, half-even unless the target is set otherwise. A right operand in another base is brought into the left one's base first, on a copy, so 0x15 + 0b1010 answers in hexadecimal.

Examples

CallAnswer
lz_add( 0.1, 0.2 )0.3
lz_add( 0x15, 0b1010 )1F base 16
lz_add( 99999999999999999999, 1 )100000000000000000000

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

  • lz_subtract The difference of two numbers, left minus right.
  • lz_plus The number itself, unchanged: the decimal standard's unary plus.
  • lzc_add The sum of two complex numbers.