title: Subtracting two decimal numbers giving weird outputs
body: <p>While I was having fun with codes from Java Puzzlers(I don't have the book) I came across this piece of code          </p>
  
  <pre><code>public static void main(String args[]) {
          System.out.println(2.00 - 1.10);
      }
  </code></pre>
  
  <p>Output is </p>
  
  <pre><code>0.8999999999999999
  </code></pre>
  
  <p>When I tried changing the code to </p>
  
  <p><code>2.00d - 1.10d</code> still I get the same output as <code>0.8999999999999999</code>  </p>
  
  <p>For,<code>2.00d - 1.10f</code> Output is <code>0.8999999761581421</code><br>
  For,<code>2.00f - 1.10d</code> Output is <code>0.8999999999999999</code><br>
  For,<code>2.00f - 1.10f</code> Output is <code>0.9</code>      </p>
  
  <p>Why din't I get the output as <code>0.9</code> in the first place? I could not make any heads or tails out of this? Can somebody articulate this?</p>