Skip to main content
Performs truncated division and remainder. T – dividend type (left-hand operand) U – divisor type (right-hand operand, must be wrapped in NonZero at call-site) The division truncates toward zero, like Cairo’s / and %.

Signature

Associated types

  • Quotient – the type produced by the division
  • Remainder – the type produced by the modulo

Examples

Identical operand types:
Heterogeneous division (u256 by u128):

Trait functions

div_rem

Computes both / and % in a single pass.

Signature

Trait types

Quotient

Quotient returned by the division.

Signature

Remainder

Remainder returned by the modulo operation.

Signature