title: Swift NumberFormatter formatting all values to 3 decimal places?
body: <p><br/><br />
  I have a large array of doubles, which have  a varying number of decimal places, such as:</p>
  
  <pre><code>[11307.3, 1025.64, 1.27826, 1676.46, 0.584175, 183.792, 1.02237, 13.649, 0.472665, 127.604]
  </code></pre>
  
  <p>I am attempting to format the number so there are commas every thousand and the decimal places are not formatted to a specific number such as 3dp. The array should look like</p>
  
  <pre><code>[11,307.3, 1,025.64, 1.27826, 1,676.46, 0.584175, 183.792, 1.02237, 13.649, 0.472665, 127.604]
  </code></pre>
  
  <p><br />
  I have tried doing this by defining NumberFormatter as such:</p>
  
  <pre><code>let numberFormatter = NumberFormatter()
  </code></pre>
  
  <p>and then choosing decimal for style:</p>
  
  <pre><code>numberFormatter.numberStyle = NumberFormatter.Style.decimal
  </code></pre>
  
  <p>The values in the array are display in a table view, and when a user taps on for example the 2nd cell, in a new screen the value 1,025.64 would be displayed.
  I used this code to do that:</p>
  
  <pre><code>var formattedPrice = numberFormatter.string(from: NSNumber(value:coinPriceDouble!))
  self.coinPriceLbl.text = "\(coinTitleText!): \(Cryptocoin.instance.fiatSymbol)\(formattedPrice!)"
  </code></pre>
  
  <p><br />
  This works perfect for any value that does not have more than 3 decimal places.
   If the user chose the 3rd value in the array, it would display 1.278 not 1.27826.
  <br /><br />
  Is there any way to format these values with commas but not force them to a specific number of decimal places?</p>