title: Is there a way to convert any generic Numeric into a Double?
body: <p>So I have a method that has 3 different types of arguments that could come in:</p>
  
  <p><code>Int32</code>, <code>Int</code> and <code>Double</code>.  So the idea was to use generics to minimize the interface</p>
  
  <pre><code>func resetProgressBarChunks&lt;T:Numeric&gt;(originalIterationCount: T) {
      guard let iCount = originalIterationCount as? Double else {return}
  </code></pre>
  
  <p>But what I have realized, is at runtime, the <code>Int32</code> and <code>Int</code> arguments will actually fail that <code>guard let</code>.  It makes sense, it was just wishful thinking on my part.</p>
  
  <p>But if I try to simply cast a <code>Numeric</code> into a double, the compiler will bark:</p>
  
  <pre><code>func resetProgressBarChunks&lt;T:Numeric&gt;(originalIterationCount: T) {
      guard let iCount = Double(originalIterationCount) else {return}
  </code></pre>
  
  <blockquote>
    <p>Cannot invoke initializer for type 'Double' with an argument of type '(T)'</p>
  </blockquote>
  
  <p>Which I suppose also makes sense, because there is no initializer for Double that takes a Generic.</p>
  
  <p>So it looks like I'm about to be forced to write 3 methods with different parameter types.  The <code>Int32</code> and <code>Int</code> parameter types would just cast into a <code>Double</code> and then call the <code>Double</code> method.  Is this really the best way?  I really was hoping I could leverage <code>Numeric</code> somehow</p>