Jump to content

Template:Calculator: Difference between revisions

w>Bawolff
No edit summary
 
m 1 revision imported: Implements the Calculator gadget and template
 
(No difference)

Latest revision as of 09:26, 23 June 2025

  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