r/programmingmemes • • 2d ago

True

Post image
1.7k Upvotes

62 comments sorted by

111

u/Crafty-Detail-3788 2d ago • Heartwarming

Modular arithmetic : 1+1=0

75

u/Business-Row-478 2d ago

unsigned integer arithmetic: 0-1=18,446,744,073,709,551,615

9

u/Wicam 1d ago

maybe, that one is dependent on other things 0-1 == ~0

-2

u/a_random_guy2718 1d ago edited 10h ago

The unsigned int max is 4,294,967,295.

The unsigned long max is 18,446,744,073,709,551,615.

Sure the are both integers technically, but one is named int and one is not.

2

u/Business-Row-478 1d ago

You don’t have to bold random words. No one said we were talking about C

1

u/Duck_Devs 20h ago

Even in C, unsigned int can be 64 bits. It’s often not though.

1

u/a_random_guy2718 10h ago edited 10h ago

I’ll be honest. I think I accidentally bolded it. Typed it on my phone, so yeah. Anyway, did not know that int max is different in other things. I just always assumed ints in everything were 32-bit and never considered that.

2

u/Krisanapon 22h ago

In inttypes.h, it is defined as UINT64_MAX and not ULONG.

70

u/gilmeye 2d ago

"B" + "a" + +"a" + "a" = "BaNaNa"

7

u/HyperCodec 2d ago

What is this from?

17

u/Vegetable-Frame-9919 2d ago

Javascript

1

u/HyperCodec 1d ago

Oh I get it now. Who tf decided it makes NaN though?

1

u/TimGreller 1d ago

Because "a" treated as number is well not a number 😅

1

u/djfdhigkgfIaruflg 1h ago

Array(16).join( ‘hero’-1) + “Batman”;

45

u/Local_Surround8686 2d ago

9

u/SoonBlossom 1d ago

They must be bots, I refuse to think those are real humans

It's so corny

28

u/promptmike 2d ago • Bravo

DEC 25 = OCT 31

🎄 = 🎃

19

u/hopeless__programmer 2d ago

JavaScript: 1+"1" = "11"

8

u/EpicGamerYesIsEpic 2d ago

and obviously, since “2”+2=”22”, “2”-2=0

3

u/Strict_Treat2884 1d ago

Whoever made concatenation and addition the same operator that also works for both string and number data types should directly go to jail

1

u/djfdhigkgfIaruflg 1h ago

Brendan Eich. He's also an homophone

16

u/LonelyPoorMan69 2d ago

Programmers like me:

*Gets PTSD*

9

u/Kanjii_weon 2d ago

if true = true

6

u/cowlinator 2d ago

if true == true <= true != !true

5

u/lucid-quiet 2d ago

true == !!true

8

u/Wushia52 2d ago

MAGA zero sum math: 1 + 1 <= 0.

5

u/Eishknaar 2d ago

As a programmer, I understood the sums in OP, but this one confuses me

12

u/Wushia52 2d ago

Used to work with a MAGA wannabe SWE. He mistook collaboration as win-lose and saw exclusion as the principle that rules the world.

5

u/SnooMaps7370 2d ago

1+1 could also = 0, if they're meeting at a XOR gate.

2

u/cowlinator 2d ago

In boolean algebra, "+" always means OR.

XOR is represented with "⊕"

2

u/mutexsprinkles 2d ago

True, but also in a finite field of 0 and 1, + is XOR and × is AND.

1

u/SnooMaps7370 2d ago

yeah, but how many people have that character on their keyboards? everyone knows boolean algebaeists are the lazyist brand, they only accept two answers.

1

u/weregod 2d ago

Not always. Some use ∧/∨ for AND/OR and + for XOR.

2

u/Key_River7180 2d ago

EASY! 2 + 2 = 0, can't you see this is a 2 bit integer?

2

u/Basic_Reporter9579 2d ago

1 + 1 = 0 and a curry bit.

1

u/Impossible-Owl7407 1d ago

Thats binary not boolean

3

u/y0shii3 2d ago

I hate when + is used for the disjunction operator

1

u/user_bw 2d ago

Boolean is more like something plus something is something. something nothing times is nothing.

1

u/looopTools 2d ago

Finite fields: 1 + 1 = 0

1

u/Responsible-Sky-1336 1d ago

Balanced ternary

1

u/sparkleshark5643 56m ago

True plus True equals a syntax error. True or True equals True

-1

u/themagicalfire 2d ago edited 1d ago

In binary 1+1 is 3 because the numbers multiply on the left:

11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1

7

u/Martiddy 2d ago

What?

1

u/TheMaskedHamster 1d ago

This is the same way decimal math works, just with fewer digits.

In decimal math, you roll over after 9, so each place can hold up from 0 to 9 of whatever value it is, ie after 9 you get 10, and after 99 you get 100. A 1 in any position means that there 10 of whatever place came before it.

In binary math, we only have two digits, so it rolls over after 1. After 1 you get 10, and after 11 you get 100.

That means

Binary | Decimal
________________
   0   |   0
   1   |   1
  10   |   2
  11   |   3
 100   |   4
 101   |   5
 110   |   6
 111   |   7

So instead of place values going up by values of 10, they go up by powers of 2.

In decimal, 999 = 900 + 90 + 9

In binary, 111 (7) = 100 (4) + 10 (2) + 1 (1)

-1

u/lucid-quiet 2d ago

01, 02, 03, ..., 08, 09, 10, 11 (decimal)

001, 010, 011, 100, 101, 110, 111 (binary)

Like a digital clock, the left flips to the next hour once the right digits count up. Like carrying the 'tens' forward in addition. They push out the left digit.

5

u/Loeris_loca 2d ago

No

11(b) is 3(d)

But 1+1 = 10(b) = 2(d)

1

u/Antagonin 1d ago

What you're actually adding is 1 + 10 + 100 bruh.

-1

u/future_pirate 1d ago edited 1d ago

IT systems guy here, in subnetting math 1+1=3, 1+1+1=7, 1+1+1+1+1+1+1+1=255

5

u/Arian-ki 1d ago

That's... just binary with plus signs for some reason

1

u/Alternative_Page_168 1d ago

1 spare for network? or broadcast?

1

u/AnxietyRodeo 1d ago

I hope you don't subnet often

/30 (your 1+1) - 4 ips, 2 usable (-broadcast, -network)

/29 (your 1+1+1) - 8 ips, 6 usable (-broadcast, -network)

/24 (your 8x 1s) - 255 ips, 253 usable (-broadcast, -network)

Then you can do fancy things like /31. 2 hosts. No network, no broadcast. Considered a point to point network

1

u/Simple-Olive895 1d ago

Lol what are you on about? That's just binary. Yes ipv4 uses binary, but represented in decimal form cause it's easier to write a subnet mask like 255.255.255.0 than to write out 24 1s and 8 0s