title: Java BigDecimal precision problems
body: <p>I know the following behavior is an old problem, but still I don't understand.</p>
  
  <pre><code>System.out.println(0.1 + 0.1 + 0.1);    
  </code></pre>
  
  <p>Or even though I use <code>BigDecimal</code></p>
  
  <pre><code>System.out.println(new BigDecimal(0.1).doubleValue()
      + new BigDecimal(0.1).doubleValue()
      + new BigDecimal(0.1).doubleValue());
  </code></pre>
  
  <p>Why this result is: <code>0.30000000000000004</code> instead of: <code>0.3</code>?</p>
  
  <p>How can I solve this?</p>