top | item 36457482

(no title)

gauddasa | 2 years ago

What you wanted to describe is already very clearly mentioned in one small paragraph on Wikipedia.

https://en.wikipedia.org/wiki/Two%27s_complement#Why_it_work...

discuss

order

tuukkah|2 years ago

To be honest, I can understand why it's not very clear to most people. I think you need a picture instead of the paragraph.

> Given a set of all possible N-bit values,

I think they lost most readers at this point with the pseudo-mathematical language. Why think of a set (when the values are ordered)? What are bit values and what's N? ("combinations of N bits" or "N-bit binary values" would be clearer.)

> we can assign the lower (by the binary value) half to be the integers from 0 to (2**(N − 1) − 1) inclusive

Or here: what does it mean to assing the "N-bit values" to be integers, what is a lower half of a set, "N-bit values by the binary value"? Where does the expression (2**(N-1)-1) come from?