title: Swift specify double without converting to string
body: <p>I want to specify my (slider) double to 2 decimals but xcode won't let me do that:</p>
  
  <pre><code>return (Double(pris, specifier: "%.2f"))
  </code></pre>
  
  <p>And i don't want to convert it into a string and then format it because numbers like 600000000 are then unreadable.</p>
  
  <p>I have tried solutions like :</p>
  
  <pre><code>extension Double {
  // Rounds the double to 'places' significant digits
    func roundTo(places:Int) -&gt; Double {
      guard self != 0.0 else {
          return 0
      }
      let divisor = pow(10.0, Double(places) - ceil(log10(fabs(self))))
      return (self * divisor).rounded() / divisor
    }
  }
  </code></pre>