title: How does ~~ work as math.floor?
body: <p>I understand that ~ is a bitwise NOT operator, but how does inverting the bits on a number twice make it function as Math.floor 
  <a href="https://stackoverflow.com/questions/4055633/what-does-do-in-javascript">What does ~~ (&quot;double tilde&quot;) do in Javascript?</a> describes the differences between using Math.floor vs bitwise operations to round numbers in Javascript, but I am interested in how exactly inverting the bits twice accomplishes this.</p>
  
  <p>Thanks</p>