title: Convert Double to Scientific Notation in swift
body: <p>I am trying to convert a given double into scientific notation, and running into some problems. I cant seem to find much documentation on how to do it either. Currently I am using:</p>
  
  <pre><code> var val = 500
   var numberFormatter = NSNumberFormatter()
   numberFormatter.numberStyle = NSNumberFormatterStyle.ScientificStyle
   let number = numberFormatter.numberFromString("\(val)")
   println(number as Double?) 
   // Prints optional(500) instead of optional(5e+2)
  </code></pre>
  
  <p>What am I doing wrong?</p>