addaptic

Reference Arithmetic

lz_divide_integer

The whole part of the quotient, truncated toward nought.

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

The whole number of times the right number goes into the left, truncated toward nought, so −7 ÷ 2 gives −3. It is taken from the exact quotient, never from one already rounded, so a quotient a hair short of a whole number is not rounded up to it.

Examples

CallAnswer
lz_divide_integer( 7, 2 )3
lz_divide_integer( −7, 2 )−3
lz_divide_integer( 1, 0.3 )3

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_divide The quotient of two numbers, left over right.
  • lz_modulo The remainder after the truncated whole quotient; the same operation as lz_remainder.
  • 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.