title: bitwise negate and bitwise XOR 1 not equivalent?
body: <p>My discrete math tells me that negate every bit of a binary number is equivalent to XOR it with 1. That is:</p>
  
  <pre><code>~1010 === 0101
  1010 XOR 111 = 0101
  </code></pre>
  
  <p>But this doesn't hold in javascript:</p>
  
  <pre><code>~123 === -124
  123 ^ 1 === 122
  </code></pre>
  
  <p>Why?</p>