title: Faster implementation of Math.round?
body: <p>Are there any drawbacks to this code, which appears to be a faster (and correct) version of <code>java.lang.Math.round</code>?</p>
  
  <pre><code>public static long round(double d) {
  
      if (d &gt; 0) {
          return (long) (d + 0.5d);
      } else {
          return (long) (d - 0.5d);
      }
  }
  </code></pre>
  
  <p>It takes advantage of the fact that, in Java, truncating to long rounds in to zero.</p>