title: How can I convert a BigDecimal to a 2-decimal-place string?
body: <p>I want to convert a BigDecimal object to a currency value to two decimal places. I don't want any rounding. How can I do it?</p>
  
  <p>None of the following approaches worked:</p>
  
  <pre><code>v = BigDecimal("7.1762")
  w = BigDecimal("4.2")
  
  v.to_s('2F')            # =&gt; "7.17 62"
  v.to_s('F')             # =&gt; "7.1762"
  v.to_s('%0.2F')         # =&gt; "0.71762E1"
  v.to_s('%0.2f')         # =&gt; "0.71762E1"
  v.truncate(2).to_s('F') # =&gt; "7.17" # This one looks like it worked
  w.truncate(2).to_s('F') # =&gt; "4.2"  # But it doesn't pad with the trailing zero(es)
  </code></pre>