Skip to content

remainder

relationalai.semantics.std.math
remainder(numerator: NumberValue, denominator: NumberValue) -> Expression

Compute the remainder of truncated division.

The result takes the sign of the dividend: remainder(-7, 2) is -1. For integer operands it satisfies the divmod identity numerator == trunc_divide(numerator, denominator) * denominator + remainder(numerator, denominator); for Float operands IEEE rounding can perturb that identity. Use modulo (or the % operator) for the floor modulo, which takes the sign of the divisor.

  • numerator

    (NumberValue) - The numerator.
  • denominator

    (NumberValue) - The denominator.
  • Expression - An Expression computing the truncated remainder. Returns Number for Number inputs, or Float for Float inputs.