title: swift: issue in converting string to double
body: <p>Here is a simple code in Xcode 7.3.1 playground:</p>
  
  <p><strong><code>var str = "8.7"
  print(Double(str))</code></strong></p>
  
  <p>the output is suprising:
  <strong><code>Optional(8.6999999999999993)</code></strong></p>
  
  <p>also, <code>Float(str)</code> gives: <code>8.69999981</code></p>
  
  <p>Any thoughts or reasons on this guys?
  Any references to this would be appreciated.</p>
  
  <p>Also, how should I then convert "8.7" to 8.7 as Double (or Float)?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>in swift:</p>
  
  <p><strong>(str as NSString).doubleValue returns 8.7</strong></p>
  
  <p>Now, that is Ok. But my question, still, does not get a complete answer. We have found an alternative but why can we not rely on Double("8.7"). Please, give a deeper insight on this.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>("6.9" as NSString).doubleValue // prints 6.9000000000000004</p>
  
  <p>So, the question opens up again.</p>