Skip to content

modulo

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

Compute the modulo (the remainder of floor division).

This is the same operation as the % operator. The result takes the sign of the divisor, matching Python: modulo(-7, 2) is 1 (not -1). For integer operands it satisfies the divmod identity numerator == floor_divide(numerator, denominator) * denominator + modulo(numerator, denominator); for Float operands IEEE rounding can perturb that identity. Use remainder for the truncated remainder (which takes the sign of the dividend).

  • numerator

    (NumberValue) - The numerator.
  • denominator

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