title: Is there a modulus (not remainder) function / operation?
body: <p>In Rust (like most programming languages), the <code>%</code> operator performs the <em>remainder</em> operation, not the <em>modulus</em> operation. These <a href="https://stackoverflow.com/q/13683563/155423">operations have different results for negative numbers</a>:</p>
  
  <pre class="lang-none prettyprint-override"><code>-21 modulus 4 =&gt; 3
  -21 remainder 4 =&gt; -1
  </code></pre>
  
  
  
  <pre><code>println!("{}", -21 % 4); // -1
  </code></pre>
  
  <p>However, I <strong>want</strong> the modulus.</p>
  
  <p>I found a workaround <code>((a % b) + b) % b</code>, but I don't want to reinvent the wheel if there's already a function for that!</p>