title: Java: BigDecimal and Double.NaN
body: <p>I am trying to execute following code:</p>
  
  <pre><code>import java.math.*;
  
  public class HelloWorld{
  
       public static void main(String []args){
              System.out.println(BigDecimal.valueOf(Double.NaN));
       }
  }
  </code></pre>
  
  <p>And reasonably, I am getting:</p>
  
  <pre><code>Exception in thread "main" java.lang.NumberFormatException                                                    
      at java.math.BigDecimal.&lt;init&gt;(BigDecimal.java:470)                                                   
      at java.math.BigDecimal.&lt;init&gt;(BigDecimal.java:739)                                                   
      at java.math.BigDecimal.valueOf(BigDecimal.java:1069)                                                 
      at HelloWorld.main(HelloWorld.java:6)    
  </code></pre>
  
  <p>Is there a way to represent <em>Double.NaN</em> in BigDecimal?</p>