title: Is it possible that a number exactly represented as float can NOT be exactly represented as double?
body: <p>I have a question which arose from another question about precision of floating numbers.</p>
  
  <p>Now, I know that floating points can not always be represented accurately and hence they are stored as the closest possible floating number that can be represented.</p>
  
  <p>My question is actually about the difference in representation of <code>float</code> and <code>double</code>.</p>
  
  <p><strong>Where does this question arise from?</strong></p>
  
  <p>Suppose I do:</p>
  
  <pre><code>System.out.println(.475d+.075d);
  </code></pre>
  
  <p>then the output would not be <code>0.55</code> but <code>0.549999</code> (on my machine)</p>
  
  <p>However, when I do :</p>
  
  <pre><code>System.out.println(.475f+.075f);
  </code></pre>
  
  <p>I get the correct answer, i.e. <code>0.55</code> (a little unexpected for me)</p>
  
  <p>Till now I was under an impression that <code>double</code> has more precision(<em>double will be more accurate upto a longer number of decimal places</em>) that <code>float</code>. So, if a double cannot be represented precisely, then its equivalent float representation will also be stored inaccurately.</p>
  
  <p>However the results I got are a little disturbing for me. I am confused if:</p>
  
  <ol>
  <li>I have an incorrect understanding of what <code>precision</code> means?</li>
  <li><code>float</code> and <code>double</code> are represented differently, apart from the fact that double has more bits?</li>
  </ol>