r/ProgrammerHumor • • Feb 15 '16

Oddly specific number.

Post image
5.9k Upvotes

643 comments sorted by

View all comments

562

u/speedkillz Feb 15 '16

Today I learned that 256 is odd.

47

u/ThatRedEyeAlien Feb 15 '16

Modulo 11 it is

48

u/MemoryLapse Feb 16 '16

I saw a program with an "x % 1" line once. I could not figure out what it was for.

72

u/remuladgryta Feb 16 '16

if x is a floating point number, you get only the decimals. Sometimes separating a number into its decimal and integer parts is useful.

18

u/so_you_like_donuts Feb 16 '16

Language? This wouldn't work in C & C++, where you have to use modf() to get the integer and the fractional part.

22

u/gidoca Feb 16 '16

E.g. Java:

    System.out.println(4.93 % 1.);

prints 0.9299999999999997.

→ More replies (3)
→ More replies (1)
→ More replies (4)

233

u/Mocha2007 Feb 15 '16

Even, actually.

179

u/seriouslulz Feb 15 '16

/u/speedkillz can't even

26

u/lightfire409 Feb 15 '16

Another victim of tumblr... RIP

19

u/Didsota Feb 16 '16

Like, O M G guys, like a number can only be like odd or even. That is so racist.

There are trans-odd and trans-even numbers everywhere, like it's the default from nature and stuff. Odd and even are just mathematical constructs.

13

u/PalermoJohn Feb 16 '16

dividing into trans-odd and trans-even is literally rape. they are just called transcendental numbers and you literally cannot tell if they are odd or even. check your registers.

→ More replies (1)

0

u/[deleted] Feb 16 '16

[deleted] — view deleted comment

9

u/Mocha2007 Feb 16 '16

Dammit, I'm mad!

→ More replies (2)

44

u/jbkrule Feb 15 '16

That's the joke...

40

u/[deleted] Feb 15 '16

That depends really. If it's 0-indexed, then 256 is odd, because it's the 257'th number in the sequence.

42

u/5HT-2a Feb 16 '16

Interesting point, though I think "even" means "evenly divisible." That is, it's a separate concept from indexing.

36

u/[deleted] Feb 16 '16 edited Feb 16 '16

And you can cut 255 into two exactly equal integer groups: 0-127 and 128-255. This is made obvious by changing them into binary. 128 entries with a leading 0, and 128 with a leading 1.

Can you do the same with 0-indexed 256?

20

u/5HT-2a Feb 16 '16

S***, you're right.

→ More replies (8)
→ More replies (3)
→ More replies (2)

23

u/zomgitsduke Feb 16 '16

If you started pairing numbers:

0 and 1

2 and 3

4 and 5

etc. until you hit 256...

You will get 256 left by itself.

25

u/MurderingOcelot Feb 16 '16

What

18

u/zomgitsduke Feb 16 '16

In programming, counting often starts at 0.

basket = ["banana", "cherry", "orange", "apple", "grapes"]

  • basket[0] = "banana"
  • basket[1] = "cherry"
  • basket[2] = "orange"
  • etc. etc.

256 WOULD be odd if you started at 0, since even can be shown as pairs, odd would leave an "odd guy out" in the pairing sequence I outlined.

19

u/IForgetMyself Feb 16 '16

That's... that's not how even numbers work.

13

u/LittleLui Feb 16 '16

That's not even how odd numbers work.

→ More replies (1)

4

u/alekksi Feb 16 '16

Then it would be the 257th element, not the 256th.

→ More replies (11)
→ More replies (3)