title: Weird Outputs of Modulo Operator in Python3
body: <p>I'm working on a modular sorter in python3 and have noticed weird behavior to do with the signs of input variables when taking the mod. I intend for it to sort a value by the remainder after dividing by the cycle length.</p>
  
  <p>I.e., <code>c = 4 / 14 = 0 r **4**", "c = 18 / 14 = 1 r **4**", and "c = 32 / 14 = 2 r **4**</code> </p>
  
  <p>All of these are 4th position values because they leave 4. However, if any of the input variables are negative, the result is not what I intend. Any ideas as to how this works (I might use this weird functionality in later coding)?</p>
  
  <pre><code>a = 4     #the value for sorting
  b = 14    #the length of the cycle before it reaches the 0 position
  
  def modS(val, cyc):
      c = val % cyc
      print(c)
  
  modS(a, b)
  </code></pre>
  
  <p>E.g.,</p>
  
  <pre><code>a = 4
  b = 14
  </code></pre>
  
  <p>prints <code>4</code></p>
  
  <pre><code>a = -4
  b = 14
  </code></pre>
  
  <p>prints <code>10</code></p>
  
  <pre><code>a = 4
  b = -14
  </code></pre>
  
  <p>prints <code>-10</code></p>
  
  <pre><code>a = -4
  b = -14
  </code></pre>
  
  <p>prints <code>-4</code></p>
  
  <p>These printed values might be useful for stuff like pH calculations, but not for my purposes.</p>