Template:Calculator

Revision as of 01:19, 28 January 2025 by w>Bawolff
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1. Note that this can return negative values if the operands are negative. To ensure that modulo n returns a number between 0 and n that fits with the values above zero, you must wrap it. A good way to do this is add the modulus and then take it again -- for positive numbers this will not change them, but for negative numbers this brings them up into the positive range. For example: (a - b)%15(((a - b)%15)+15)%15