Jan 20, 2009

Give me the best way to multiply an integer by 3.5

Give me the best way to multiply an integer by 3.5.
There are many solutions to this but (x>>1)+x+(x<< 1) is the best since it is least prone to overflowing. ((x << 2)+(x>>1))

No comments:

Post a Comment