On May 23, 2023, debian-u...@howorth.org.uk wrote: > Dan Purgert <d...@djph.net> wrote: > > On May 22, 2023, gene heskett wrote: > > > I don't see it, 255 is all 8 bits set, 256 is all 8 bits cleared > > > and carry set. > > > > In "natural counting", 2^8 is 256. (1, 2, 3, 4, ... , 256). > > In any counting, 2^8 is 256. "2^8 is 256" is just a way of saying in > English the same as the assertion "2^8 == 256" in a programming > language. They are exactly the same statement. And they are true. > That's all Tomas was saying.
I explicitly mentioned natural counting, since we don't order objects from zero (e.g. objects on a table are counted as "1,2,3,4,5", not "0,1,2,3,4"). You still get 256 total values in binary counting, it's just that the set of values is offset by a count of one from the position where they fall in the set. That is, the value of "zero" is at the "first position" (likewise, the value 255 is at the 256th position). > And yes you need 9 bits in binary to say it. You only need 9 bits if you want to display some (decimal) value that would fit in the 257th - 512th position of a computer's zero-based counting system (i.e. 256-511). -- |_|O|_| |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
signature.asc
Description: PGP signature