title: Can all 32 bit ints be exactly represented as a double?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3793838/which-is-the-first-integer-that-an-ieee-754-float-is-incapable-of-representing-e">Which is the first integer that an IEEE 754 float is incapable of representing exactly?</a>  </p>
  </blockquote>
  
  
  
  <p>This is basic question, my feeling is that the answer is yes(int = 32 bits, double = 53 bit mantisa + sign bit). </p>
  
  <p>Basically can asserts fire?</p>
  
  <pre><code>int x = get_random_int();
  double dx = x;
  int x1 = (int) dx;
  assert(x1 ==x);
  if  (INT_MAX-10&gt;x)
   {
         dx+=10;
         int x2=(int) dx;
         assert(x+10 == x2);
   }
  </code></pre>
  
  <p>Obviously stuff involving complicated expressions with divisions and similar stuff (    (int)(5.0/3*3) is not the same as 5/3*3)wont work, but I wonder do conversions and adition/substraction(if no overflow occurs) preserve equivalence. </p>