title: How to convert Any number to Double?
body: <p>I need to do some raw data parsing and I am forced to work with <code>Any</code> type.</p>
  
  <p>If the data I read is in any numeric format (<code>Int</code>/<code>Double</code>/<code>Long</code>/...) I need to convert it to <code>Double</code>, otherwise (eg. <code>String</code>) I need to leave it empty.</p>
  
  <p>This is what I came up with:</p>
  
  <pre><code>def extractDouble(expectedNumber: Any): Option[Double] = expectedNumber match {
    case i: Int =&gt; Some(i.toDouble)
    case l: Long =&gt; Some(l.toDouble)
    case d: Double =&gt; Some(d)
    case _ =&gt; None
  }
  </code></pre>
  
  <p>This obviously doesn't look even decently. Is there any better way to deal with this in Scala?</p>