title: How to make a generic function for several numeric types?
body: <p>Let's say I have these functions </p>
  
  <pre><code>// bar is some external function
  // it has signature bar(_ number: Double) -&gt; Double
  
  func foo(number: Int) -&gt; Double {
      return bar(Double(number))
  }
  
  func foo(number: Float) -&gt; Double {
      return bar(Double(number))
  }
  
  func foo(number: Double) -&gt; Double {
      return bar(number)
  }
  </code></pre>
  
  <p>I want to have one generic function:</p>
  
  <pre><code>func foo&lt;T&gt;(number: T) -&gt; Double {
      return bar(Double(number))
  }
  </code></pre>
  
  <p>But it seems that compiler does not like this idea:</p>
  
  <p><a href="https://i.stack.imgur.com/xaOmc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xaOmc.png" alt="enter image description here"></a></p>
  
  <p>How to properly make such generic functions in swift3? Or is it impossible?</p>