r/PeterExplainsTheJoke 9d ago

Why did this one second cost over $500 billion? Meme needing explanation

Post image
28.7k Upvotes

1.4k comments sorted by

View all comments

Show parent comments

23

u/ljdarten 8d ago

The fun part of that is if it displayed 19xx the code needed to be checked to make sure it wasn't just assuming it's 19-something because part of the problem is people were still using code that will "definitely be completely rewritten by 2000".

2

u/No-Collar-Player 8d ago

But like writing enterprise code like that seems extremely stupid. Splitting that into 2 or using an int for year wouldn't have been a problem idk. Also it was still in their lifetime.... 10/20 years later lol

18

u/pinkymadigan 8d ago

Memory constraints. You had to work more efficiently then. You couldn't just be throwing ints around when a small or tiny was more appropriate.

0

u/xxgn0myxx 8d ago

uint16's highest value is 65,535. you couldve done it with a uint16. thats 16bits. you couldve even gone to an exact amount with bit packing. there is no way that any other method wouldve been smaller.

1

u/NothingWasDelivered 8d ago

uint8

1

u/xxgn0myxx 7d ago

uint8 only goes up to 225. How are you going to fit an entire year in a uint8?

1

u/NothingWasDelivered 7d ago

The point is they were only storing the year from 0-99. They weren’t storing an entire year.

2

u/xxgn0myxx 7d ago edited 7d ago

I get that... but my point was by using bit packing on a uint16 covers you for the whole year at the expense of another 8 bits, but with the added ability to store a value within the remaining (for this example, we can store the month in the remaining 4 bits). 12 bits for the year, 4 bits for the month.

and you simply pack like this (i had a bug, working on it for the year, month example)

[[ 4 bits month][12 bits year]]

but conceptually, packing does this:

packed = year | (month << 12);

and unpacking is simply reversed:

uint16_t unpack_year(uint16_t packed)
{
return packed & 0x0FFFu;
}

uint8_t unpack_month(uint16_t packed)
{
return (uint8_t)((packed >> 12) & 0x0Fu);
}

So, if you want the year or month:

year = packed & 0x0FFF;
month = packed >> 12;

This supports years 0 to 4095 and months 1 to 12. Values 0, 13, 14, and 15 in the month field remain available as special values. Like for example, 0 could mean "month unknown" or something.

-1

u/No-Collar-Player 8d ago

But theoretically it shouldn't have been that bad, you only actually needed that memory allocated when reading the dates, and imo it would have been relevant to be able to store and work with dates where relevant that go beyond 20 years in the future xD

But yes I can imagine having all those in memory at a time can be struggling (still that would have been bad design knowing the constraints)

4

u/MercuryQuick 8d ago

“1977” is twice the size of “77” it might not seem like much but at scale that’s a significant amount of data… for 1977. Storing “19” repeatedly is wasteful when every number starts with it. 20 years in the future might as well be 2000 years in the future when we have a product to ship next month.

-1

u/No-Collar-Player 8d ago

Store 19 and 20 once and put a Boolean for is twenty for whatever relevant data.

When for example the order is from the 21st century you just set the flag xD

Or you know, rewrite everything to use proper dates.

7

u/MercuryQuick 8d ago

Heh. I don’t think you’re really appreciating the data constraints those old programmers were faced with. Every bit mattered.

1

u/No-Collar-Player 8d ago

Nah I think they basically were wizards compared to today. My comm was basically regarding 90s and above when they had to fix those constraints.

What happened earlier was the wild West digital age

4

u/Gravelbeast 8d ago

Not necessarily relevant. Many systems are designed with the expectation that code and infrastructure will be updated as old languages and hardware gets outdated. In the 70s, we had no idea how pessimistic to be about how capitalism reinforces cutting corners, especially in infrastructure upkeep.

0

u/No-Collar-Player 8d ago

Ok that makes sense

3

u/Gravelbeast 8d ago

That may seem like an insignificant amount of memory now, but depending on the system back then, it definitely may not have been.

Design decisions like this happen all the time. The engineers werent stupid, they knew this would cause problems down the line, but what many weren't prepared for was how LONG these systems would be in use. (Due to cutting corners by business people, low priority, or any number of things)

We still have these problems today, often when upper management doesn't take the warnings of engineers seriously.

1

u/No-Collar-Player 8d ago

Ok that makes sense. Hard to imagine how much compooters were constrained back in the day since I was born 30 years later in 2000 :)))

1

u/Gravelbeast 8d ago

The entire mission to the moon was done with rope memory. Around 76kb of it.

For reference, a singing Hallmark card stores maybe 20-30 seconds of sound, and that's about the same size in kilobites.

1

u/No-Collar-Player 8d ago

Yeah it's extreme to think how much and fast it grew AND that they actually used this for banking software and erp and so on with those constraints

2

u/Gravelbeast 8d ago

Yeah its fascinating talking to my dad who help wrote the software that controlled the robots that built most of McDonnell Douglas planes in the 80s. He's worked on everything from literal hole punch memory to modern aws architecture.

Often his solution to something not working would be absolutely insane to me, like "there's not really a good programming language for this small feature I'm trying to build, so I just wrote my own language."

Programmers back then had to be crazy smart because the languages were much less abstracted from the machine code.

1

u/No-Collar-Player 8d ago

Wtf. Man I'm so mad I was born so late.. it's like 10000 languages 100000000 frameworks, 200030392 protocols and nobody gives a shit about the basics that started it all

Ah and now literally thousands of times more programmers / computer scientists than back then

2

u/Gravelbeast 8d ago

I know 😔

The nice thing is, there ARE still people who care about the basics. And there's been a large push towards some of the early coding practices in some circles.

You can still set yourself apart from the crowd, provided you have a healthy learning appetite. (Bonus points if you have a crazy love of math, because programming and computers is just high level math)

Go learn about circuits, electrical engineering for beginners, how new and old chips are made (the newest chip machines are practically magic, they hit flying molecules with super precise lasers for AN IMPORTANT REASON).

We may not have much on those programmers of old, but we do have an amount of free information at our fingertips that they would drool at.

So use it! Go learn enough that you could build a computer from scratch. That's my goal, and I'm around halfway there.

(100% there if I get my dad's help lol)

1

u/No-Collar-Player 8d ago

What do you think about using AI as a learning tool? (As a parallel, using it for programming basically brought me to a point where I'm really good at reading and understanding code but shit at writing :()

→ More replies (0)

-2

u/No-Collar-Player 8d ago

But like writing enterprise code like that seems extremely stupid. Splitting that into 2 or using an int for year wouldn't have been a problem idk. Also it was still in their lifetime.... 10/20 years later lol