0571: "Can't Sleep"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

User avatar
glasnt
Posts: 539
Joined: Fri Jan 25, 2008 5:18 am UTC
Location: SQUEE!

0571: "Can't Sleep"

Postby glasnt » Mon Apr 20, 2009 4:02 am UTC

Image

Alt: If androids someday DO dream of electric sheep, don't forget to declare sheepCount as a long int.





I hate when this happens. Then again, I like counting in cubic roots. I do like how the sheep start going in the other direction.

User avatar
TheHand
Posts: 178
Joined: Mon May 05, 2008 8:03 am UTC

Re: "Can't Sleep" Discussion

Postby TheHand » Mon Apr 20, 2009 4:03 am UTC

If counting upwards makes you fall asleep, does counting negative numbers make you more and more awake?

User avatar
aeris92
Posts: 43
Joined: Wed Mar 25, 2009 4:03 am UTC

Re: "Can't Sleep" Discussion

Postby aeris92 » Mon Apr 20, 2009 4:03 am UTC

argh maybe ill make the discussion next time.. for now im going to go count my own sheep and recover from the fact that xkcd was updated a minute late.

User avatar
dennisw
Posts: 441
Joined: Wed Nov 05, 2008 9:09 am UTC
Location: Appearing pro se AND pro bono!
Contact:

Re: "Can't Sleep" Discussion

Postby dennisw » Mon Apr 20, 2009 4:04 am UTC

I'd suggest that you consider unsigned long long ints. Screw it - go straight for bignums.
Try the Printifier for xkcd. You can now scale the comic between 50 and 150%.

I find these very useful: Common Errors in English Usage (web site) and Eats, Shoots & Leaves (book). You may, too.

e pluribus unum
Unleash unlicensed ungulates!

peterd08
Posts: 6
Joined: Fri Sep 05, 2008 1:50 am UTC

Re: "Can't Sleep" Discussion

Postby peterd08 » Mon Apr 20, 2009 4:04 am UTC

It was the alt text that made this one for me. Oh, long ints.
"Some men just want to watch the world burn"

Spoiler:
You have to admit, that'd be pretty awesome to watch from space...

Comic JK
Posts: 270
Joined: Wed Feb 18, 2009 6:08 pm UTC

Re: "Can't Sleep" Discussion

Postby Comic JK » Mon Apr 20, 2009 4:06 am UTC

I remember how happy I was when I first realized what the pokemon Mareep was about...

An electric sheep, for those who follow the xkcd 178 strategy.
Image
A webcomic funnier than life itself. Updated Monday-Friday.

User avatar
jspenguin
Posts: 84
Joined: Wed Apr 16, 2008 7:39 pm UTC
Contact:

Re: "Can't Sleep" Discussion

Postby jspenguin » Mon Apr 20, 2009 4:06 am UTC

I'm trying to get to sleep, and I'm using my new phone that runs Android, so...

Vacate my cranium, Randall.

Code: Select all

from __future__ import skynet

User avatar
joee
Posts: 227
Joined: Mon Dec 03, 2007 5:53 am UTC

Re: "Can't Sleep" Discussion

Postby joee » Mon Apr 20, 2009 4:07 am UTC

I almost fell off my chair laughing at this one.

p.s. hi glasnt!
Hi glasnt.

syckls
Posts: 31
Joined: Mon Jan 14, 2008 8:27 am UTC

Re: "Can't Sleep" Discussion

Postby syckls » Mon Apr 20, 2009 4:08 am UTC

That must be a real problem. I know if I heard 216-1 baas at the same time, I wouldn't be able to sleep for the rest of the night.
There are 3 kinds of people in this world: those who accept the Law of the Excluded Middle, those who don't, and those who are neither of the above.

User avatar
glasnt
Posts: 539
Joined: Fri Jan 25, 2008 5:18 am UTC
Location: SQUEE!

Re: "Can't Sleep" Discussion

Postby glasnt » Mon Apr 20, 2009 4:11 am UTC

joee wrote:I almost fell off my chair laughing at this one.

p.s. hi glasnt!


Hi joee!


I, too, have found that my chair at work is quite stable in that regard.

User avatar
Anubis
Posts: 222
Joined: Sun Mar 01, 2009 7:59 am UTC

Re: "Can't Sleep" Discussion

Postby Anubis » Mon Apr 20, 2009 4:15 am UTC

I didn't get it until I read the alt-text. Then it was hilarious.

User avatar
Briareos
Posts: 1940
Joined: Thu Jul 12, 2007 12:40 pm UTC
Location: Town of the Big House

Re: "Can't Sleep" Discussion

Postby Briareos » Mon Apr 20, 2009 4:15 am UTC

Randall, I can't believe you would treat such an important issue like insomnia so lightly. Don't you know a lot of people have serious sleeping problems!

Not cool; not funny; not a good comic.
Sandry wrote:Bless you, Briareos.

Blriaraisghaasghoasufdpt.
Oregonaut wrote:Briareos is my new bestest friend.

Nihiltres
Posts: 23
Joined: Mon Oct 13, 2008 3:39 pm UTC

Re: "Can't Sleep" Discussion

Postby Nihiltres » Mon Apr 20, 2009 4:20 am UTC

The real question here is: do you have to recurse at all to count the 65,535 sheep heading negative*?


*
Spoiler:
RAMBLINGS: Here, negative → left. Also, do you curse when you recurse? Also, *? reminds me of regex. /me goes to sleep now.

User avatar
Snowdream
Posts: 128
Joined: Fri Sep 26, 2008 1:36 am UTC

Re: "Can't Sleep" Discussion

Postby Snowdream » Mon Apr 20, 2009 4:21 am UTC

All those sheep O_o
Image

Storm
Posts: 79
Joined: Mon Aug 25, 2008 4:37 am UTC
Contact:

Re: "Can't Sleep" Discussion

Postby Storm » Mon Apr 20, 2009 4:21 am UTC

I laughed so hard when I read this one, it might just be the sleep deprivation though. I'm off to count electric sheep!
Three Quotes:
Spoiler:
"DON'T PANIC" - Douglas Adams
"All that is gold does not glitter, Not all those who wander are lost"- J.R.R. Tolkien
"This life is more than just a read through"- Red Hot Chili Peppers

calico
Posts: 10
Joined: Tue Nov 18, 2008 2:09 am UTC
Location: The Lappy
Contact:

Re: "Can't Sleep" Discussion

Postby calico » Mon Apr 20, 2009 4:22 am UTC

This is amazing! Thanks Randall! ...though I half expected the negative sheep to go "aaab"
Oh no, I've said too much; I haven't said enough

tuckels
Posts: 29
Joined: Mon Feb 23, 2009 5:43 am UTC

Re: "Can't Sleep" Discussion

Postby tuckels » Mon Apr 20, 2009 4:23 am UTC

Comic JK wrote:I remember how happy I was when I first realized what the pokemon Mareep was about...

An electric sheep, for those who follow the xkcd 178 strategy.


Oh me yarm. I'm embarrassed i never got this before.

User avatar
darkspork
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: "Can't Sleep" Discussion

Postby darkspork » Mon Apr 20, 2009 4:27 am UTC

My mind works this way as well. It's always out to screw me over. Interesting how all of the sheep can count to 764,586.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY

User avatar
Jahoclave
sourmilk's moderator
Posts: 4790
Joined: Thu Oct 25, 2007 8:34 pm UTC
Contact:

Re: "Can't Sleep" Discussion

Postby Jahoclave » Mon Apr 20, 2009 4:27 am UTC

Briareos wrote:Randall, I can't believe you would treat such an important issue like insomnia so lightly. Don't you know a lot of people have serious sleeping problems!

Not cool; not funny; not a good comic.

As a member of the insomniac crowd I would like to point out that I am not offended and do so appreciate that our condition is finally making press.

User avatar
Editer
Posts: 68
Joined: Mon Mar 31, 2008 4:17 am UTC

Re: "Can't Sleep" Discussion

Postby Editer » Mon Apr 20, 2009 4:30 am UTC

OK, who's up for explaining the joke to this non-techie? I gather it has something to do with the limit of some processing task, and on that basis I see (and like) the humor, but I'd like to understand it better.

Thanks!
These days, if you don't have ADD, you not paying close enough attention. -- J.P. Barlow

User avatar
TheHand
Posts: 178
Joined: Mon May 05, 2008 8:03 am UTC

Re: "Can't Sleep" Discussion

Postby TheHand » Mon Apr 20, 2009 4:34 am UTC

I'm not sure the joke is about insomnia per say. Sometimes people just can't sleep without being a constant insomniac.

kcsand
Posts: 3
Joined: Mon Jan 19, 2009 2:41 pm UTC

Re: "Can't Sleep" Discussion

Postby kcsand » Mon Apr 20, 2009 4:34 am UTC

eeep. i couldn't sleep, so went to check xkcd. irony. and insomniacs rule!

User avatar
HalfGearHeart
Posts: 5
Joined: Wed Mar 04, 2009 11:50 pm UTC

Re: "Can't Sleep" Discussion

Postby HalfGearHeart » Mon Apr 20, 2009 4:35 am UTC

Editer wrote:OK, who's up for explaining the joke to this non-techie? I gather it has something to do with the limit of some processing task, and on that basis I see (and like) the humor, but I'd like to understand it better.

Thanks!



http://en.wikipedia.org/wiki/Short_integer

User avatar
athelas
A Sophisticated Plagiarism Engine
Posts: 584
Joined: Sat Oct 21, 2006 2:37 am UTC

Re: "Can't Sleep" Discussion

Postby athelas » Mon Apr 20, 2009 4:39 am UTC

Haha, I originally thought it was going into the irrationals or imaginary numbers, as per http://xkcd.com/313/

User avatar
dennisw
Posts: 441
Joined: Wed Nov 05, 2008 9:09 am UTC
Location: Appearing pro se AND pro bono!
Contact:

Re: "Can't Sleep" Discussion

Postby dennisw » Mon Apr 20, 2009 4:40 am UTC

Try the Printifier for xkcd. You can now scale the comic between 50 and 150%.

I find these very useful: Common Errors in English Usage (web site) and Eats, Shoots & Leaves (book). You may, too.

e pluribus unum
Unleash unlicensed ungulates!

User avatar
Editer
Posts: 68
Joined: Mon Mar 31, 2008 4:17 am UTC

Re: "Can't Sleep" Discussion

Postby Editer » Mon Apr 20, 2009 4:43 am UTC

HalfGearHeart wrote:
Editer wrote:OK, who's up for explaining the joke to this non-techie? I gather it has something to do with the limit of some processing task, and on that basis I see (and like) the humor, but I'd like to understand it better.

Thanks!



http://en.wikipedia.org/wiki/Short_integer


OK, so the count of the sheep was defined as a short integer, in this case topping out at 2^16 -1, and when the actual count reached that level it cycled to the negative value (expressed visually as a metric buttload of sheep jumping the other direction) and started going up from there. Did I get that right? Cool and clever.

Thanks!
These days, if you don't have ADD, you not paying close enough attention. -- J.P. Barlow

Tim Harrod
Posts: 8
Joined: Sun Oct 14, 2007 7:04 pm UTC

Re: "Can't Sleep" Discussion

Postby Tim Harrod » Mon Apr 20, 2009 4:47 am UTC

There appears to be a missing minus sign in panel 3.

Angafirith
Posts: 3
Joined: Mon Apr 20, 2009 4:28 am UTC

Re: "Can't Sleep" Discussion

Postby Angafirith » Mon Apr 20, 2009 4:48 am UTC

Briareos wrote:Randall, I can't believe you would treat such an important issue like insomnia so lightly. Don't you know a lot of people have serious sleeping problems!

Not cool; not funny; not a good comic.

I got up in the middle of the night, unable to sleep. First thing I saw was this. I found it pretty funny.

If we take every serious matter to be sacred and immune from ridicule, the world becomes a humorless place.

OK, who's up for explaining the joke to this non-techie? I gather it has something to do with the limit of some processing task, and on that basis I see (and like) the humor, but I'd like to understand it better.

It's about representing numbers in binary, basically.
http://en.wikipedia.org/wiki/Signed_num ... sentations
The length of a number is fixed to a certain number of bits. I'll simplify it to decimal numbers. Let's say you can only hold two digits. What happens when you add one to 99? You get 100, but that won't fit. It ends up overflowing, and you end up with 00. Basically, if you add one to the highest possible number you can hold (32767 in a signed 16-bit integer), you'll overflow to the lowest possible number (-32768 in a signed 16-bit integer). The alt-text stresses the importance of using a 32-bit integer instead, which would stick the upper limit up into the billions somewhere.

And... someone got to it before me. Darn.

User avatar
aleflamedyud
wants your cookies
Posts: 3307
Joined: Tue Oct 09, 2007 7:50 pm UTC
Location: The Central Bureaucracy

Re: "Can't Sleep" Discussion

Postby aleflamedyud » Mon Apr 20, 2009 4:50 am UTC

Silly Randall. You really should use Scheme in which sheep-count will naturally roll over and convert into a bignum.
"With kindness comes naïveté. Courage becomes foolhardiness. And dedication has no reward. If you can't accept any of that, you are not fit to be a graduate student."

Tim Harrod
Posts: 8
Joined: Sun Oct 14, 2007 7:04 pm UTC

Re: "Can't Sleep" Discussion

Postby Tim Harrod » Mon Apr 20, 2009 4:58 am UTC

Basically, if you add one to the highest possible number you can hold (32767 in a signed 16-bit integer), you'll overflow to the lowest possible number (-32768 in a signed 16-bit integer). The alt-text stresses the importance of using a 32-bit integer instead, which would stick the upper limit up into the billions somewhere.


Gahhh, I was wrong. Live 'n' learn!

User avatar
Editer
Posts: 68
Joined: Mon Mar 31, 2008 4:17 am UTC

Re: "Can't Sleep" Discussion

Postby Editer » Mon Apr 20, 2009 5:02 am UTC

Angafirith: Thanks for a clear and thorough explanation.
These days, if you don't have ADD, you not paying close enough attention. -- J.P. Barlow

User avatar
glasnt
Posts: 539
Joined: Fri Jan 25, 2008 5:18 am UTC
Location: SQUEE!

Re: "Can't Sleep" Discussion

Postby glasnt » Mon Apr 20, 2009 5:08 am UTC

Tim Harrod wrote:There appears to be a missing minus sign in panel 3.

That, my good friend, is the overflow.

User avatar
HalfGearHeart
Posts: 5
Joined: Wed Mar 04, 2009 11:50 pm UTC

Re: "Can't Sleep" Discussion

Postby HalfGearHeart » Mon Apr 20, 2009 5:10 am UTC

Angafirith wrote:
Briareos wrote:Randall, I can't believe you would treat such an important issue like insomnia so lightly. Don't you know a lot of people have serious sleeping problems!

Not cool; not funny; not a good comic.

I got up in the middle of the night, unable to sleep. First thing I saw was this. I found it pretty funny.

If we take every serious matter to be sacred and immune from ridicule, the world becomes a humorless place.


It's a longstanding joke/meme. He's not actually offended.

CrossCompiler
Posts: 2
Joined: Wed Jan 02, 2008 8:52 am UTC

Re: "Can't Sleep" Discussion

Postby CrossCompiler » Mon Apr 20, 2009 5:11 am UTC

When I was a your age the joke was ... 6, 7, -8, -7 ...
And uphill, both ways.

User avatar
HalfGearHeart
Posts: 5
Joined: Wed Mar 04, 2009 11:50 pm UTC

Re: "Can't Sleep" Discussion

Postby HalfGearHeart » Mon Apr 20, 2009 5:18 am UTC

My question is:

If (sheepCount == -32,768) is represented by 32,768 sheep jumping in the opposite(in this case leftward) direction over the fence, why, in the very next panel, isn't -32,767 represented as 32,767 sheep jumping leftward as well? That way when the count reaches 0, there should be 1+2+3...+32,767 sheep on the left side of the fence.

User avatar
lordofnarf
Posts: 38
Joined: Fri Apr 10, 2009 6:00 am UTC

Re: "Can't Sleep" Discussion

Postby lordofnarf » Mon Apr 20, 2009 5:21 am UTC

CrossCompiler wrote:When I was a your age the joke was ... 6, 7, -8, -7 ...
And uphill, both ways.


And programmers were real programmers, using magnetized needles and steady hands?

I had to look up the punchline, but that's pretty funny.

IamReck
Posts: 1
Joined: Mon Apr 20, 2009 5:15 am UTC

Re: "Can't Sleep" Discussion

Postby IamReck » Mon Apr 20, 2009 5:21 am UTC

Its for C++ type int data types...

Don't ints have a range of -32767 to 32767? So it shouldn't go to -32768 after 32727 but -32767...

As always good comic!

User avatar
sea otter
Posts: 42
Joined: Fri Feb 15, 2008 6:05 am UTC
Location: a hilbert space by lake michigan

Re: "Can't Sleep" Discussion

Postby sea otter » Mon Apr 20, 2009 5:24 am UTC

Tim Harrod wrote:
Basically, if you add one to the highest possible number you can hold (32767 in a signed 16-bit integer), you'll overflow to the lowest possible number (-32768 in a signed 16-bit integer). The alt-text stresses the importance of using a 32-bit integer instead, which would stick the upper limit up into the billions somewhere.


Gahhh, I was wrong. Live 'n' learn!


Thank you kindly, Tim. My sleep-deprived brain was wondering about this as well.

I have problems with insomnia as well, but in my case it's most likely due to too little exercise.

Loved this comic.

qtip
Posts: 1
Joined: Mon Apr 20, 2009 5:13 am UTC

Re: "Can't Sleep" Discussion

Postby qtip » Mon Apr 20, 2009 5:27 am UTC

If we're talking about C here, and since the size of an int is defined by the compiler (and usually based on the processor it is compiled for), I would say int would probably be the best choice as it is usually the fastest size integer the processor can use (typically a word). By the time androids dream of electric sheep, I doubt they'd be running on 32-bit (or 16-bit, heaven forbid) processor architectures.

User avatar
darkspork
Posts: 532
Joined: Tue Sep 23, 2008 12:43 am UTC
Location: Land of Trains and Suburbs

Re: "Can't Sleep" Discussion

Postby darkspork » Mon Apr 20, 2009 5:32 am UTC

IamReck wrote:Its for C++ type int data types...

Don't ints have a range of -32767 to 32767? So it shouldn't go to -32768 after 32727 but -32767...

As always good comic!

There are 65536 different values that can be stored in an int, signed or not. You're forgetting about 0. there are 65535 values in the range [-32767, 32767] just as there are 3 values in the range [-1, 1].

Edit: Nvm. I misread your post. you're correct.
Last edited by darkspork on Mon Apr 20, 2009 5:34 am UTC, edited 1 time in total.
Shameless Website Promotion: Gamma Energy
My new esoteric programming language: GLOBOL
An experiment to mess with Google Search results: HARDCORE PORNOGRAPHY HARDCORE PORNOGRAPHY


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: No registered users and 108 guests