[ library(gfd) | Reference Manual | Alphabetic Index ]

<ConsistencyModule:> divmod(?X,?Y,?Q,?M)

Constrains Q to X // Y, and M to X rem Y.
X
An integer or (domain) variable (array notation accepted)
Y
An integer or (domain) variable (array notation accepted)
Q
An integer or (domain) variable (array notation accepted)
M
An integer or (domain) variable (array notation accepted)

Description

Constrains Q to be the integer quotient of X and Y (X // Y), and M to be the remainder (X rem Y). Q is rounded towards 0.

CAUTION: this predicate is misnamed, Gecode actually implements the ECLiPSe arithmetic operations // and 'rem', not 'div' and 'mod'. The difference only matters when arguments are negative.

ConsistencyModule is the optional module specification to give the consistency level for the propagation for this constraint: gfd_bc for bounds consistency.