title: Cast Any to Float always fails in swift4.1
body: <p>In the former version, to get a float value from a <code>[String: Any]</code> dictionary, I can use <code>let float = dict["somekey"] as? Float</code>, but in swift4.1, it doesn't work. It seems the type of <code>dict["somekey"]</code> has been implicitly inferred as <code>Double</code> before I get it, so casting from <code>Double</code> to <code>Float</code> always fails. I wonder if it is a new characteristic or just a bug.</p>
  
  <p>--Here is the update.</p>
  
  <p>I re-downloadeded an Xcode9.2 and did some experiments, now I think I figure out what's going on. Here is the test code:</p>
  
  <pre><code>let dict: [String : Any] = ["key": 0.1]
  
  if let float: Float = dict["key"] as? Float {
      print(float)
  } else {
      print("nil")
  }
  
  let dict1: [String : Any] = ["key": NSNumber(value: 0.2)]
  
  if let float: Float = dict1["key"] as? Float {
      print(float)
  } else {
      print("nil")
  }
  
  let number = NSNumber(value: 0.3)
  if let float: Float = number as? Float {
      print(float)
  } else {
      print("nil")
  }
  
  let number1 = NSNumber(floatLiteral: 0.4)
  if let float = number1 as? Float {
      print(float)
  } else {
      print("nil")
  }
  </code></pre>
  
  <p>Running this code in Playground of Swift4 and Swift4.1, the results are different. In Swift4, the results are <code>nil</code> <code>0.2</code> <code>0.3</code> <code>0.4</code>, and In Swift4.1 the results are <code>nil</code> <code>nil</code> <code>nil</code> <code>nil</code>. From the result, I can learn two points:
  1. When we convert JSON data into a <code>[String : Any] dictionary</code> with the <code>JSONSerialization</code> class, the numeric value is saved as an <code>NSNumber</code> object, but not <code>Int</code>, <code>Double</code> or <code>Float</code>.
  2. In Swift4, we can use <code>let float = NSNumberOjbect as? Float</code> to get a <code>Float</code> value, but in Swift4.1 we can't. But still, we can get <code>Int</code> or <code>Double</code> value in this way, either in Swift4 or Swift4.1.
  Finally again, is this a new feature or a bug? If someone knows, can you guys show up the announcement link?</p>