lz_remainder
The remainder after the truncated whole quotient, left − trunc(left ÷ right) × right.
long lz_remainder( CLZNumber* leftOperand, CLZNumber* rightOperand, CLZNumber* targetNumber = nullptr );
The whole quotient is truncated toward nought, so the answer has the left operand's sign. It is exact and keeps every place it has. lz_remainder and lz_modulo are the same operation under two names; lz_remainder_near takes the nearest whole quotient instead.
Examples
| Call | Answer |
|---|---|
lz_remainder( 7, 2 ) | 1 |
lz_remainder( −7, 2 ) | −1 |
lz_remainder( 1, 0.3 ) | 0.1 |
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_moduloThe remainder after the truncated whole quotient; the same operation as lz_remainder.lz_remainder_nearThe remainder after the nearest whole quotient, ties to even.lz_divide_integerThe whole part of the quotient, truncated toward nought.