this post was submitted on 28 Mar 2024
368 points (93.6% liked)

Programmer Humor

32558 readers
673 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] prime_number_314159@lemmy.world 30 points 8 months ago (3 children)

From smallest to biggest:

Bits (basic unit)

Bytes (8:1 reduction)

Words (4:1 reduction)

KiB (32:1 reduction)

MiB (1024:1)

GiB (1024:1)

TiB (1024:1)

PiB (1024:1)

A normal amount of porn (237:1)

[–] barsoap@lemm.ee 14 points 8 months ago* (last edited 8 months ago) (2 children)

All definitely not metric as metric uses steps of 1000 (and there's also 10 and 100 and 1/10th and 1/100th but that doesn't extend to 10000 and 1/10000th).

The KiB, MiB, etc, the 2^10 scale is called binary prefixes (as opposed to decimal prefixes KB, MB, etc) and standardised by the IEC.

And while the B in KiB is always going to mean eight bits it's not a given that a byte is actually eight bits, network people still use "octet" to disambiguate because back in the days there were plenty of architectures around with other byte sizes. "byte" simply means "smallest number of bits an operation like addition will be done in" in the context of architectures. Then you have word for two bytes, d(ouble)word for four, q(uad)word for eight, o(cto)word for 16, and presumably h(ex)word for 32 it's already hard to find owords in the wild. Yes it's off by one of course it's off by one what do you expect it's about computers. There's also nibble for half a byte.

EDIT: Actually that's incorrect word is also architecture-dependent, the word/dword/qword sequence applies to architectures (like x86) which went from being 16-bit machines to now being 64 bit while keeping backwards compatibility. E.g. RISC-V uses 32-bit words, 16 bits there are a half-word.

The bit, at least, is not under contention everyone agrees what it is. Though you can occasionally see people staring in wild disbelief and confusion at statements such as "this information can be stored in ~1.58 bits". That number is ~ log~2~ 3, that is, the information that fits in one trit. Such as "true, false, maybe".

[–] notfromhere@lemmy.ml 3 points 8 months ago

Great write up, glad to see mention of nibble (my favorite lol)… You forgot to mention byte order (Little/Big Endian).

[–] prime_number_314159@lemmy.world 2 points 7 months ago

So you're saying my proposed imperial units depend on where you are, and who is using them, for what purpose? That just sells me on them as imperial units even more. :)

Thank you for the details.

[–] ryannathans@aussie.zone 4 points 8 months ago

Words aren't always four bytes

[–] uis@lemm.ee 0 points 7 months ago

Words (4:1 reduction)

Word is imperial unit. Like one british gallon is not equal to one us gallon, one x86 word is not equal one ARM word.