C++

Asked • 07/11/19

Is multiplication and division using shift operators in C actually faster?

Multiplication and division can be achieved using bit operators, for example i*2 = i<<1 i*3 = (i<<1) + i; i*10 = (i<<3) + (i<<1) and so on. Is it actually faster to use say `(i<<3)+(i<<1)` to multiply with 10 than using `i*10` directly? Is there any sort of input that can't be multiplied or divided in this way?

1 Expert Answer

By:

Keith B. answered • 12/21/20

Tutor
4.6 (22)

Software Engineer and Math Geek

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.