title: Java iterator in double value
body: <p>I am trying to iterate the value of I from 1 to 0 or from 0 to 1. But I have got some problem.
  Please check the following codes:</p>
  
  <pre><code>double i = 1.0;
  loop{  // Just use a loop to iterate the i. This is just a pseudocode. 
         // We can use while-loop or for-loop or timer. 
         // (I know there is no keyword "loop" in java)
  
     i -=0.1;
  
     if( i == 0.0){
       // stop the loop
     }
  }
  </code></pre>
  
  <p>In the above code, the loop will never stop because when the variable i will become 0.7000000001 when i = 0.8 - 0.1 during the loop. i will have lots of decimal number when i = 0.1 - 0.1. so it will never equal to 0.0.</p>
  
  <p>I apologized if my description of my question is not clear enough for you.
  This may be a very easy question for pro programmers. But I cannot figure it out. Please let me know what I have done wrong.</p>