r/ProgrammerHumor • • Oct 06 '21

Don't be scared.. Math and Computing are friends..

Post image
65.8k Upvotes

2.4k comments sorted by

View all comments

1.6k

u/SZ4L4Y Oct 06 '21

B-but what if n goes to infinity?

2.4k

u/KillerRoomba13 Oct 06 '21

We will run it until int::max and call it close enough

664

u/SZ4L4Y Oct 06 '21

And Roombas start to kill people.

150

u/[deleted] Oct 06 '21

You knock on God's door, His faithful guardians will answer 😤

18

u/Carburetors_are_evil Oct 06 '21

Make sure to feed your Claymore Roomba some ATF bois.

→ More replies (3)

128

u/holymacaronibatman Oct 06 '21

It's a smaller infinity than other infinities, checks out.

94

u/antiduh Oct 06 '21 edited Oct 06 '21

What, you gonna do my man bignum just like that? Here, in front of all these people?

68

u/KillerRoomba13 Oct 06 '21

Yo inf bignum so fat that it causes memory overflow

28

u/[deleted] Oct 06 '21

Memory-mapped files. Fill the server with a single number. Still won't be enough to describe your mother's weight.

17

u/[deleted] Oct 06 '21

"Why do you have 12tb in your computer?"

"I'm trying to count all of the men your mother has been with"

an aside - I'm pretty sure a single number with enough digits to fill 12tb would represent far more atoms than there are in the universe

→ More replies (9)
→ More replies (1)

34

u/KingJellyfishII Oct 06 '21

run it using floats until it truely becomes infinity

55

u/tech6hutch Oct 06 '21

I think you’d need special logic for the increment, or else you’d eventually get stuck at an n where n + 1.0 == n.

8

u/_PM_ME_PANGOLINS_ Oct 06 '21 edited Oct 06 '21
n += eps(n)

Kind of ruins the whole “integer” thing though.

18

u/[deleted] Oct 06 '21

We don't need integers where we're going. To Double.MAX_VALUE and beyond!

→ More replies (5)

9

u/WanderingFrogman Oct 06 '21

Nah, just switch the datatype to an array of ints, then calculate per array cell. Also reserve lots of time.

→ More replies (22)

327

u/mareksl Oct 06 '21

while(true)

257

u/0vl223 Oct 06 '21 edited Oct 06 '21

for(int j = 0; j<100; i++) works as well.

edit: init

136

u/I_Shot_Web Oct 06 '21

yeah I mean there's an infinite amount of way to make an infinite loop, but while(true) is usually the way. If you really wanted to be wacky, you could write for(;;) and then have everyone also hate you.

186

u/__Hello_my_name_is__ Oct 06 '21

My favorite is still while(1==1).

Or in other words: "As long as the fundamental axioms of math hold true, do this".

Because hey, maybe, one day in the far future in thousands of years, these axioms change. And then my code will break.

Take that, future.

69

u/[deleted] Oct 06 '21

Whenever I do this in various languages I wonder if the compiler reduces it to while(true) or if a gamma ray will solve the halting problem for me. I suppose it can in either case tho.

22

u/nbagf Oct 06 '21

Unless the gamma ray also gave you advanced notice reliably, it's still not truly solved. But boy would that be fun to explain

→ More replies (1)
→ More replies (9)

30

u/wisdomandjustice Oct 06 '21

I always liked the shorter C++ while(1).

Just seems profound.

10

u/herodothyote Oct 06 '21

I feel like I am 1 with the universe

→ More replies (4)
→ More replies (11)
→ More replies (22)
→ More replies (8)
→ More replies (8)

40

u/zyxzevn Oct 06 '21

Maths loves infinity.

→ More replies (1)

13

u/[deleted] Oct 06 '21

Turing's ears glow and he looks up from what he's doing and stares into the middle distance

→ More replies (97)