Well, I am new here and this is my first post, please be not to harsh if I missed some forum rules

While reading the documentation for the

Bitshift operation I struggled over:

In that case, the sign bit is copied into lower bits, for esoteric historical reasons:

I'm unhappy with that since

two's complement is neither historic nor esoteric - nearly every processor implements negative integers this way. Injecting the one for negative numbers keeps them negative and makes sure that division by powers of two for negative numbers works as expected. One could argue that this might be to deep into number representation theory, but a few lines later exactly this division is shown:

If you are careful to avoid sign extension, you can use the right-shift operator >> as a way to divide by powers of 2. For example:

Here it gets completely unhelpful: you are told to avoid the sign but in reality everything just works, due to the injected one.

My proposal: drop "for esoteric historical reasons", and mention that the injected ones guarantee proper results for negative numbers in the bottom.

/Iterationbound

P.S. (Maybe it would be nice to have a page on number representation anyway where it would be possible to get deeper into the details)