title: No 'clamp' candidates produce the expected contextual result type 'CGFloat'
body: <p><a href="https://i.stack.imgur.com/C3wl2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3wl2.png" alt="enter image description here"></a></p>
  
  <p>I explicitly cast the type between them, but the error is still there</p>
  
  <pre><code> var destX:CGFloat  = 5.0
  
  func clamp(value: CGFloat, min: CGFloat, max: CGFloat) -&gt; CGFloat {
  if value &gt; max {
      return max
  }
  else if value &lt; min {
      return min
  }
  return value
  }
  
   override func update(_ currentTime: TimeInterval) {
  
  
  let ballRadius: CGFloat = 10
  destX = simd.clamp(destX, min: ballRadius, max: frame.width - ballRadius) as CGFloat
  let destXAction = SKAction.moveTo(x: destX, duration: 0.1)
  self.main.run(destXAction)
  </code></pre>
  
  <p>Here is the code</p>