addaptic

Reference Arithmetic

lz_modulo

The remainder after the truncated whole quotient; the same operation as lz_remainder.

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

left − trunc(left ÷ right) × right, the whole quotient truncated toward nought, so the answer has the left operand's sign. It is exact and keeps every place it has. lz_modulo and lz_remainder are the same operation under two names.

Examples

CallAnswer
lz_modulo( 7, 2 )1
lz_modulo( −7, 2 )−1
lz_modulo( 5.5, 2 )1.5

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_remainder The remainder after the truncated whole quotient, left − trunc(left ÷ right) × right.
  • lz_remainder_near The remainder after the nearest whole quotient, ties to even.
  • lz_divide_integer The whole part of the quotient, truncated toward nought.