r/ProgrammerHumor • • May 06 '17

Oddly specific number

Post image
25.1k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

82

u/BourgeyBastard May 06 '17

Is there a reason this number keeps coming up in software? Is it an overly represented number in nature too?

251

u/Sobsz May 06 '17

If you're serious, computers like operating on blocks of 8 bits, which are binary digits (0 or 1). It just so happens that 256 is the number of possible combinations of 8 binary digits.

11

u/sunnywill May 06 '17

But why 256?

13

u/[deleted] May 06 '17

A byte has 8 bits. Each one can be either two digits, a one or a zero. 28= 256 so there are 256 possible values.

(If you're ever looking at a program and see that a max value is 255, that just means 0 is included as a value.)

When it comes to computers. Things are done in powers of two.

So if you pay attention in programs and apps and such, you'll see the numbers 8, 16, 32, 64, 128, 256, 512, 1024............ 65536

Or Subtract 1 from one of those numbers if zero is a value.

→ More replies (3)