title: smart way to do calculation near int overflow
body: <p>Is there any smart way to fix this issue?</p>
  
  <pre><code>uint32_t a = 16637510;
  uint32_t b = 45627362;
  uint32_t c = 0;
  c = a * 100000 / b //overflows
  c = (a * 100/b)*1000 //gives 36000
  </code></pre>
  
  <p>I need to get result c = 36463 or better 36464. And fast, non float operations are required. CPU is stm32f4</p>
  
  <p>Update:</p>
  
  <p>Accepted answer is converting 100000 to 100000ULL (64 bit) but as @PeterJ suggested (and deleted his answer) using stm32f4 FPU is faster then 64 dividing operations</p>
  
  <pre><code>Timer t;
  int i;
  t.start();
  for(i = 1; i &lt;= 100000; ++i) c = a * 100000ULL / b;
  t.stop();
  printf("64\ttakes %f seconds, du is %d\n", t.read(), c);
  t.reset();
  t.start();
  for(i = 1; i &lt;= 100000; ++i) c = (uint32_t)((float)a * 100000.0f / (float)b);
  t.stop();
  printf("float\ttakes %f seconds, du is %d\n", t.read(), c);
  t.reset();
  </code></pre>
  
  <blockquote>
    <p>64 takes 0.086669 seconds, du is 57333<br>
    float  takes 0.017779 seconds, du is 57333  </p>
  </blockquote>