title: What has a better performance: multiplication or division?
body: <p>Which version is faster:
  <code>x * 0.5</code>
  or
  <code>x / 2</code> ?</p>
  <p>I've had a course at the university called computer systems some time ago. From back then I remember that multiplying two values can be achieved with comparably &quot;simple&quot; logical gates but division is not a &quot;native&quot; operation and requires a sum register that is in a loop increased by the divisor and compared to the dividend.</p>
  <p>Now I have to optimise an algorithm with a lot of divisions. Unfortunately it's not just dividing by two, so binary shifting is not an option. Will it make a difference to change all divisions to multiplications ?</p>
  <p>Update:</p>
  <p>I have changed my code and didn't notice any difference. You're probably right about compiler optimisations. Since all the answers were great ive upvoted them all. I chose rahul's answer because of the great link.</p>