title: Why is calculation using float variable different from what I think?
body: <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  {
      float r = 31.0f;
      float pi = 3.14f;
      float volume = 4.0f / 3.0f * pi * r * r * r;
      
      printf(&quot;volume = %f\n&quot;, volume);
      
      float k1 = 4.0f / 3.0f;
      printf(&quot;k1 = %f\n&quot;, k1);
  
      float k2 = k1 * pi;
      printf(&quot;k2 = %f\n&quot;, k2);
  
      float k3 = k2 * r;
      printf(&quot;k3 = %f\n&quot;, k3);
  
      float k4 = k3 * r;
      printf(&quot;k4 = %f\n&quot;, k4);
  
      float k5 = k4 * r;
      printf(&quot;k5 = %f\n&quot;, k5);
  
  
      return 0;
  }
  </code></pre>
  <p>I'm beginner in C.</p>
  <p>I thought that variable 'k5' must equal to 4023.387207 x 31 = 124725.003417</p>
  <p>(I have learned so far that float variable is accurate up to six decimal points.)</p>
  <p>But the output shows that k5 == 124725.000000</p>
  <p>Why is this happening like this?</p>
  <p>(My English is not very good, so please understand.)</p>