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

Programmer Humor

31791 readers
162 users here now

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

Rules:

founded 5 years ago
MODERATORS
top 30 comments
sorted by: hot top controversial new old
[–] [email protected] 118 points 9 months ago (1 children)

This joke is so old, time since epoch was negative when it was made

[–] [email protected] 31 points 9 months ago (2 children)

My birthday was the epoch so I resemble this comment.

[–] [email protected] 7 points 9 months ago

Hello, fellow oldhead :)

[–] [email protected] 1 points 8 months ago

So you were born at the dawn of time... nice.

[–] [email protected] 65 points 9 months 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
[–] [email protected] 9 points 9 months ago

Thanks! I didn't get it at first xD

[–] [email protected] 6 points 9 months ago* (last edited 9 months 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.

[–] [email protected] 15 points 9 months ago (1 children)

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

[–] [email protected] 9 points 9 months ago (1 children)

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

[–] [email protected] 5 points 9 months 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.

[–] [email protected] 2 points 9 months ago

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

[–] [email protected] 61 points 9 months ago (4 children)

I just wanted a short explanation.

Is this even right?

[–] [email protected] 43 points 9 months ago (1 children)

In the language man I wonder what the language is

[–] [email protected] 9 points 9 months ago (1 children)

I bet I lost that part of the explanation when I asked for layman's terms.

[–] [email protected] 19 points 9 months ago (1 children)

Nah, pretty sure that is just a (very mild) hallucination because it couldn't find an actual good example

[–] [email protected] 5 points 9 months ago

Yeah, problem is that I'm not aware of anyone who actually writes octal numbers as "OCT123" nor decimal numbers as "DEC123". It's basically a made-up syntax, supposed to look plausible for both date notation and number system notation. It's part of the joke, which LLMs won't understand.

[–] [email protected] 27 points 9 months ago (1 children)
[–] [email protected] 6 points 9 months ago

Cool, the plausible answers are always the most dangerous.

[–] [email protected] 5 points 9 months ago* (last edited 9 months ago) (1 children)

Except for the part about using OCT or DEC to talk about octal and decimal numbers is ok.

From wikipedia:

In programming languages, octal literals are typically identified with a variety of prefixes, including the digit 0, the letters o or q, the digit–letter combination 0o, or the symbol &[12] or $. In Motorola convention, octal numbers are prefixed with @, whereas a small (or capital[13]) letter o[13] or q[13] is added as a postfix following the Intel convention.[14][15] In Concurrent DOS, Multiuser DOS and REAL/32 as well as in DOS Plus and DR-DOS various environment variables like $CLS, $ON, $OFF, $HEADER or $FOOTER support an \nnn octal number notation,[16][17][18] and DR-DOS DEBUG utilizes \ to prefix octal numbers as well.

For example, the literal 73 (base 8) might be represented as 073, o73, q73, 0o73, \73, @73, &73, $73 or 73o in various languages.

Newer languages have been abandoning the prefix 0, as decimal numbers are often represented with leading zeroes. The prefix q was introduced to avoid the prefix o being mistaken for a zero, while the prefix 0o was introduced to avoid starting a numerical literal with an alphabetic character (like o or q), since these might cause the literal to be confused with a variable name. The prefix 0o also follows the model set by the prefix 0x used for hexadecimal literals in the C language; it is supported by Haskell,[19] OCaml,[20] Python as of version 3.0,[21] Raku,[22] Ruby,[23] Tcl as of version 9,[24] PHP as of version 8.1,[25] Rust[26] and it is intended to be supported by ECMAScript 6[27] (the prefix 0 originally stood for base 8 in JavaScript but could cause confusion,[28] therefore it has been discouraged in ECMAScript 3 and dropped in ECMAScript 5[29]).

I think 0o31 would be the "correctish" way a programmer/computer scientist would talk about it.

[–] [email protected] 8 points 9 months ago

Advanced calculators (both physical ans virtual) have DEC/BIN/OCT/HEX buttons so there is some truth to this abbreviation.

[–] [email protected] 1 points 9 months ago

Is anyone else bothered by how often things are reiterated in this reply?

[–] [email protected] 17 points 9 months ago

hint for those who don't get it= HEX19

[–] [email protected] 16 points 9 months ago (2 children)

Who use octal numbers in their program? If you do, why?

[–] [email protected] 5 points 9 months ago

Only for representing permissions bits

[–] [email protected] 4 points 9 months ago

Aircraft SSR codes are octal

[–] [email protected] 14 points 9 months ago

Just put on A Nightmare Before Christmas and you're good to go.

[–] [email protected] 13 points 9 months ago

i love how well this joke works

[–] [email protected] 4 points 9 months ago

Halloween is the time for hexes!

[–] [email protected] 3 points 9 months ago

I remember it being graffitti’d at Wean Hall at Carngie Mellon circa 1990. (about half way down architect’s leap for fellow CMU-nies, around fifth floor maybe?).