this post was submitted on 31 Oct 2023
831 points (96.3% liked)

Programmer Humor

32426 readers
625 users here now

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

Rules:

founded 5 years ago
MODERATORS
 

toot by @nixCraft@mastodon.social

you are viewing a single comment's thread
view the rest of the comments
[–] glibg10b@lemmy.ml 65 points 1 year ago (3 children)

Explanation:

In decimal (DEC), we count to 9 before adding a new digit. For example, the number after 9 is 10, and the number after 19 is 20.

In octal (OCT), we count to 7 before adding a new digit. The number after 7 is 10 and the number after 17 is 20.

DEC OCT
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 20
17 21
18 22
19 23
20 24
21 25
22 26
23 27
24 30
25 31
[–] Balthazar@sopuli.xyz 9 points 1 year ago

Thanks! I didn't get it at first xD

[–] kylostillreigns@lemmy.world 6 points 1 year ago* (last edited 1 year ago) (2 children)

TLDR: In octal system, the weight of the digit in a position is an exponent of 8. So 31 = (3×8¹ + 1×8⁰) = (3×8 + 1×1) = 24 + 1 = 25.

[–] glibg10b@lemmy.ml 15 points 1 year ago (1 children)

I think you might be stretching the definition of TLDR a bit lol

[–] siipale@sopuli.xyz 9 points 1 year ago (1 children)

Well, it's certainly shorter than the table in the parent comment.

[–] glibg10b@lemmy.ml 5 points 1 year ago

Sure, it's shorter, but is it really a summary of my comment, or just a more technical explanation?

My comment tries to teach via example, while theirs tries to teach using math. I chose my method because it's the most accessible to people who aren't math-inclined, but also because it takes the least cognitive effort to understand, which is an important quality for a social media comment to have nowadays.

Besides, you obviously don't have to read the whole table (you already know how to count to 25). Just scan the right column to see what it's doing differently.

[–] MaryTzu@aussie.zone 2 points 1 year ago

It's the same for every base, including base 10.