Modulo (Negative Numbers)

Calculate modulo for negative numbers (mathematical definition).

Formula

Math modulo: ((a % b) + b) % b — always non-negative
  • Math modulo: ((a % b) + b) % b — always non-negative

Modulo (Negative Numbers)

Modulo (Negative Numbers) calculation.

Frequently asked questions

How is Modulo (Negative Numbers) calculated?
Math modulo: ((a % b) + b) % b — always non-negative