title: Why float division is faster than integer division in c++?
body: <p>Consider the following code snippet in C++ :(visual studio 2015)</p>
  
  <p><strong>First Block</strong></p>
  
  <pre><code>const int size = 500000000;
  int sum =0;
  int *num1 = new int[size];//initialized between 1-250
  int *num2 = new int[size];//initialized between 1-250
  for (int i = 0; i &lt; size; i++)
  {
      sum +=(num1[i] / num2[i]);
  }
  </code></pre>
  
  <p><strong>Second Block</strong></p>
  
  <pre><code>const int size = 500000000;
  int sum =0;
  float *num1 = new float [size]; //initialized between 1-250 
  float *num2 = new float [size]; //initialized between 1-250
  for (int i = 0; i &lt; size; i++)
  {
      sum +=(num1[i] / num2[i]);
  }
  </code></pre>
  
  <p>I expected that   first block runs faster because it is integer operation . But the Second block is considerably faster , although it is floating point operation . here is results of my bench mark : 
  Division:
  </p>
  
  <pre><code>Type    Time
  uint8   879.5ms
  uint16  885.284ms
  int     982.195ms
  float   654.654ms
  </code></pre>
  
  <p>As well as floating point multiplication is faster than integer multiplication.
  here is results of my bench mark :</p>
  
  <p>Multiplication:
  </p>
  
  <pre><code>Type    Time
  uint8   166.339ms
  uint16  524.045ms
  int     432.041ms
  float   402.109ms
  </code></pre>
  
  <p>My system spec: CPU core i7-7700 ,Ram 64GB,Visual studio 2015</p>