title: Why is Javascript's Math.floor the slowest way to calculate floor in Javascript?
body: <p>I'm generally not a fan of microbenchmarks. But this one has a very interesting result.<br>
  <a href="http://ernestdelgado.com/archive/benchmark-on-the-floor/" rel="noreferrer">http://ernestdelgado.com/archive/benchmark-on-the-floor/</a>  </p>
  
  <p>It suggests that <code>Math.floor</code> is the SLOWEST way to calculate floor in Javascript. <code>~~n</code>, <code>n|n</code>, <code>n&amp;n</code> all being faster.<br>
  This seems pretty shocking as I would expect that people implementing Javascript in today's modern browsers would be some pretty smart people. </p>
  
  <p>Does floor do something important that the other methods fail to do? Is there any reason to use it?</p>