title: Javascript Tilde & Two's complement
body: <p><a href="http://en.wikipedia.org/wiki/Two%27s_complement" rel="noreferrer">Two's complement method</a> -  generates <code>-(x + 1)</code>.</p>
  
  <p>for example  when JavaScript encounters the Tilde he uses this method: </p>
  
  <pre><code>~5 = -(5+1) = -6.
  </code></pre>
  
  <p>Fine - lets go deeper.</p>
  
  <p>Now lets talk about the Two's complement method.</p>
  
  <pre><code>5        = 0000 0101
  Flip     = 1111 1010
  add one  = 1111 1011
  </code></pre>
  
  <p>so <code>1111 1011</code> is <code>-5</code>.</p>
  
  <p>how ? </p>
  
  <p>again : flip : </p>
  
  <pre><code>0000 0100 
  </code></pre>
  
  <p>add one : </p>
  
  <pre><code>0000 0101
  </code></pre>
  
  <p>And so it was <code>-5</code>.</p>
  
  <p>So how does this settle with  <code>~5=-6</code> ?</p>
  
  <p>where this <code>-6</code> came from ?</p>