Java: Calculations returning wrong answer?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/322749/retain-precision-with-doubles-in-java">Retain precision with Doubles in java</a><br>
  <a href="http://stackoverflow.com/questions/4937402/moving-decimal-places-over-in-a-double">Moving decimal places over in a double</a>  </p>
</blockquote>



<p>For example, something as simple as this:</p>

<pre><code>public class WrongAnswer {
  public static void main(String[] args) {
    System.out.println(100*1.1);
  }
}
</code></pre>

<p>prints 110.00000000000001 instead of 110.  Using other numbers instead of 100*1.1 also give a lot of digits with some random digit at the end that isn't right..</p>

<p>Any ideas?</p>
