title: Precision of numbers, multiply and divide by 100
body: <p>I have the following test cases</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() { 
  
      double x = 3.987;
  
      printf("x = %lf\n", x);
  
      printf("(double) (long) (x) = %lf\n", (double) (long) (x));
  
      printf("(x*100)/100 = %lf\n", (x*100)/100);
  
      printf("(double) (long) (x*100)/100 = %lf\n", (double) (long) (x*100)/100);
  
      printf("(double) (long) (x*10)/10 = %lf\n", (double) (long) (x*10)/10);
  
      return 0;
  }
  </code></pre>
  
  <p>The output is: </p>
  
  <pre><code>x = 3.987000
  (double) (long) (x) = 3.000000
  (x*100)/100 = 3.987000
  (double) (long) (x*100)/100 = 3.980000
  (double) (long) (x*10)/10 = 3.900000
  </code></pre>
  
  <p>It seems to me that multiplying by 100 and dividing by 100 would cancel each other out? but It is actually decreasing the precision. How does this work exactly?</p>