title: Why pow(10,5) = 9,999 in C++
body: <p>Recently i write a block of code:</p>
  
  <pre><code>const int sections = 10;
  
  for(int t= 0; t &lt; 5; t++){
     int i = pow(sections, 5- t -1);  
     cout &lt;&lt; i &lt;&lt; endl;
  }
  </code></pre>
  
  <p>And the result is wrong:</p>
  
  <pre><code>9999
  1000
  99
  10
  1
  </code></pre>
  
  <p>If i using just this code:</p>
  
  <pre><code>for(int t = 0; t &lt; 5; t++){
      cout &lt;&lt; pow(sections,5-t-1) &lt;&lt; endl; 
  }
  </code></pre>
  
  <p>The problem doesn't occur anymore:</p>
  
  <pre><code>10000
  1000
  100
  10
  1
  </code></pre>
  
  <p>Does anyone give me an explaination? thanks you very much!</p>