title: Java: increment through Float.floatToIntBits?
body: <p>I need to increment a float value atomically. I get its int value by calling Float.floatToIntBits on it. If I just do an i++ and convert it back to float, it does not give me the expected value. So how would I go about it?</p>
  
  <p>(I'm trying to create an AtomicFloat through AtomicInteger, hence this question).</p>
  
  <p>EDIT: here's what I did:</p>
  
  <pre><code>Float f = 1.25f;
  int i = Float.floatToIntBits(f);
  i++;
  f = Float.intBitsToFloat(i);
  </code></pre>
  
  <p>I wanted 2.25, but got 1.2500001 instead.</p>