title: Floating point multiplication in java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/153724/how-to-round-a-number-to-n-decimal-places-in-java">How to round a number to n decimal places in Java</a>  </p>
  </blockquote>
  
  
  
  <p>When multiplying two numbers in java happens this:</p>
  
  <pre><code>double a = 9.495 * 100;
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>a = 949.5;
  </code></pre>
  
  <p>But the obtained result is: </p>
  
  <pre><code>a = 949.4999999999999
  </code></pre>
  
  <p>When I try to round number 9.495 in two decimal places the result is 9.49 instead of 9.50</p>
  
  <p>Any ideas how to solve this problem?</p>