title: Formatting with 2 decimal places (NSDecimalNumber)
body: <p>I have an extension in my NSDecimalNumber</p>
  
  <pre><code>extension NSDecimalNumber {
      func format(f: String) -&gt; String {
          return String(format: "%\(f)f", self)
      }
  }
  </code></pre>
  
  <p>This should allow me to do the following: </p>
  
  <pre><code>var price = 34.2499999
  
  price.format(f: ".2") // 35.25
  </code></pre>
  
  <p>Instead, I get 0.00 in my <code>UICollectionViewCell</code>:</p>
  
  <pre><code>func configureCell(_ item: Item) {
  
          self. item = item
  
          nameLabel.adjustsFontSizeToFitWidth = true
          priceLabel.adjustsFontSizeToFitWidth = true
          nameLabel.text = self. item.name.capitalized
          priceLabel.text = "£\(self. item.price!.format(f: ".2"))"
  
      }
  </code></pre>
  
  <p>I would like to format it with the real price showing two decimal places instead of a random number. All prices are retrieved from a database and are accurate with only 2 decimal places.</p>
  
  <p>For some reason, when I remove the formatting from the extension, I get more decimals where I only have 2 in the database. Why is this happening and how is it solved?</p>