Modulo Variants

7
3

Current: 7 mod 3

Implementation

Truncated (same sign as dividend)

r = a - n × trunc(a/n)

Floored (same sign as divisor)

r = a - n × floor(a/n)

Euclidean (always non-negative)

r = a - |n| × floor(a/|n|)

Rounded (quotient rounded)

r = a - n × round(a/n)

Ceiling (opposite sign of divisor)

r = a - n × ceil(a/n)