[5] Performing this operation is simple in decimal arithmetic, in the binary numeral system used in computer programming, and in other even-numbered bases.
[5] However, for the sake of software portability and readability, it is often best to write programs using the division operation and trust in the compiler to perform this replacement.
So in this case, the compiler cannot optimize division by two by replacing it by a bit shift, when the dividend could possibly be negative.
In binary floating-point arithmetic, division by two can be performed by decreasing the exponent by one (as long as the result is not a subnormal number).
Many programming languages provide functions that can be used to divide a floating point number by a power of two.