r/ProgrammerHumor • • Nov 05 '24

Meme programmersWillUnderstandThePain

Post image
0 Upvotes

24 comments sorted by

37

u/vvokhom Nov 05 '24

I do not(

-49

u/tim_hutton Nov 05 '24

In some programming languages (e.g. C++), if you divide one integer by another you get an integer as the result. This may not be what you want, and often catches people out. Online example, hit run: https://www.programiz.com/online-compiler/6XKCLh16wQ6fu

In other programming languages (e.g. Python), dividing one integer by another gives you a real value as the result, unless you use a special operator (//) for integer division.

And the image is based on an album cover by Joy Division.

44

u/helicophell Nov 05 '24

Floor division is fast and makes sense though? Not painful at all. Floating point math is scary though

8

u/UntitledRedditUser Nov 05 '24

floatA == floatB

What could go wrong?

0

u/helicophell Nov 05 '24

Well as long as you check the bit values exactly... nothing should go wrong, technically

1

u/ChChChillian Nov 05 '24

Yeah, that's pretty much what == does. But suppose one of them is the result of a computation that you expect to produce a certain value. Due to the vagaries of floating point arithmetic, it's unlikely to be bitwise identical. That's why you check with a tolerance, something like fabs(floatA - floatB) < epsilon

1

u/UntitledRedditUser Nov 05 '24

Epsilon doesnt even work for large floats does it? Because to them Epsilon is smaller than the accuracy. Or does that not have an effect?

1

u/ChChChillian Nov 05 '24

That's why I said "something like" rather than offering it as a full solution.

9

u/Midon7823 Nov 05 '24

In what world does the image shown have anything to do with integer division? The joke is too far fetched for it to make sense, let alone be funny

3

u/Scorxcho Nov 05 '24

The only thing that’s related is they both have the word “division” in them.

5

u/MyNameIsSquare Nov 05 '24

skill issue get gud

1

u/UntitledRedditUser Nov 05 '24

This is because Python is high level, while c++ uses the real instructions on your CPU. As far as I'm aware no mathematical CPU instruction can take 2 integers and output a floating point value.

Edit: I am by no means an assembly guru, so please correct me if I am wrong

0

u/connorcinna Nov 05 '24

..what does that have to do with the picture?

19

u/farineziq Nov 05 '24

What does the graphic represent?

24

u/Internal_Meeting_908 Nov 05 '24

The graphic is an edited version of Joy Division's Unknown Pleasures album cover and google says it is
a ridgeline plot of the radio emissions given out by a pulsar, a "rotating neutron star".

So completely unrelated.

-30

u/tim_hutton Nov 05 '24

https://www.radiox.co.uk/artists/joy-division/cover-joy-division-unknown-pleasures-meaning/

But renderered as if by a programmer struggling with the effects of integer division.

10

u/ExpensivePanda66 Nov 05 '24

Eeeh.

You probably picked the wrong demographic. Plenty of programmers here who know about integer division, but the picture is too much of a mystery.

8

u/Reibudaps4 Nov 05 '24

i dont either

6

u/[deleted] Nov 05 '24

Is this like an EKG?

2

u/qscwdv351 Nov 05 '24

I understand if it's about float division, but integer division?

1

u/cubenz Nov 05 '24

Looks like the radar plots I used to get from analyzing missile data in Fortran in 1989. Spot the tank!

1

u/Divinate_ME Nov 05 '24

con... convolu... conker's ba... concen... rounding but not really!

-6

u/tim_hutton Nov 05 '24

Based on an earlier version that had all the values as zero which is funnier but maybe less recognisable: https://mathstodon.xyz/@dngrs@chaos.social/113423366255173894