title: Bytes to megabytes in ruby
body: <p>In javascript (or coffeescript), I have the following function: </p>
  
  <pre><code>bytesToMegabytes = (bytes) -&gt;
    return Math.round((b/1024/1024) * 100) / 100
  </code></pre>
  
  <p>I'm trying to recreate it in ruby. I have:</p>
  
  <pre><code>def bytes_to_megabytes (bytes)
      (((bytes.to_i/1024/1024) * 100) / 100).round
  end
  </code></pre>
  
  <p>But this rounds differently? For example, 1153597 becomes 1 in the ruby code.</p>