Follow

numbers, trivial observation 

@amiloradovsky@functional.cafe technically, while addressable, the entire space might not be representable with an N bit address either. In general you would want to specify/represent it with a range, which would be two numbers, beginning and the end. In this case we can fix the beginning as 0 inclusive, and use an N bit number to represent the end, but this is still not enough, need one more bit to specify whether the endpoint is included or not
[0,N?
If, as with 0, you decide it's always inclusded - can't represent the empty range [0,0), and otherwise - the longest representable range [0,2^N-1) would be of length 2^N-1. Not willing to spare a bit, the latter is what people usually end up with, since the empty range is much more useful, than one extra memory slot. Then the same N bit number is then enough to represent the length of any representable range, without being counter-intuitive.

TL;DR - It's just a question of whether you want the empty range or the full (2^N element) range to be representable in general, address or length, ordinal or cardinal, it's the same.

Sidenote: address 0 is not arbitrary, if it was arbitrary, I would have had to specify it and use whopping 2N bits for my range representation in this trivial example. I do enough of that in real code, so thank you precious 0 for saving me the trouble.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.