this post was submitted on 28 Dec 2023
4 points (100.0% liked)

Programmer Humor

19570 readers
1649 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
top 10 comments
sorted by: hot top controversial new old
[–] [email protected] 0 points 10 months ago (1 children)

I like this bit at the end:

As a side note, the program is amazingly performant. For small numbers the results are instantaneous and for the large number close to the 2^32 limit the result is still returned in around 10 seconds.

[–] [email protected] 0 points 10 months ago

Really makes you question your sanity when optimizing jumps in code without benchmarks.

[–] [email protected] -1 points 10 months ago

I honestly thought this was going to be about AI 😅

CC BY-NC-SA 4.0

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

Let's be real though, everything is IF statements all the way down

[–] [email protected] 0 points 10 months ago

There's not a single thing in this universe that cannot be accomplished with enough IF statements... as long as you've got infinite time to wait

[–] [email protected] 0 points 10 months ago (2 children)

Could be easily made 50% space saving by only iffin all odds and return even on else. Maybe one if before to handle overflow to avoid wrong even if over the last if.

[–] [email protected] 0 points 10 months ago* (last edited 10 months ago)

Yeah but then ALL even numbers would be slow to compute because you would have to chain through every odd before you know that 2 is even.

Depends on the expected distribution of input values

[–] [email protected] 0 points 10 months ago

Well yeah, if you allow cheating!

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

Now we just need to someone to package it and upload it to NPM.

[–] [email protected] 0 points 10 months ago* (last edited 10 months ago)

What's another 40 gb of node_modules anyway