390
all 48 comments
sorted by: hot top controversial new old
[-] BorgDrone@lemmy.one 58 points 9 months ago

Are you indexing your fingers or counting them ?

Indexing starts ar 0 but counting starts at 1.

[-] FriendOfElphaba@sh.itjust.works 27 points 9 months ago

This.

One of the reasons indexing starts at zero is because back when we used to use pointers and memory addresses, the first byte(s) of an array were at the address where the array was stored. Let’s say it is at 1234. If it was an array of bytes, the first data element was at 1234, or 1234 + 0. The second element would be at 1235, or 1234 + 1. So the first element is at location 0 and the second at location 1, where the index is actually just an offset from the base address. There may be other/better reasons, but that’s what I was taught back in the 90s.

Counting always starts at 1 (if we’re only using integers). You don’t eat a hamburger and say you ate zero hamburgers.

[-] Haus@kbin.social 10 points 9 months ago* (last edited 9 months ago)

There was a time when I had to switch back and forth between Fortran90 and C several times a day, and it messed me up so bad that doing simple tasks like counting apples at the grocery gave me anxiety.

[-] Sonotsugipaa@lemmy.dbzer0.com 9 points 9 months ago

I do say I ate zero hamburgers if I just started counting and I have yet to eat one

[-] FriendOfElphaba@sh.itjust.works 2 points 9 months ago

When you’ve eaten more than 50% of the hamburger, do you claim to have eaten one, or do you claim zero? Are you useing standard founding or are you using floor()?

[-] Sonotsugipaa@lemmy.dbzer0.com 2 points 9 months ago

I create a Vulkan instance, a device, a compute pipeline then use an image sampler with VK_FILTER_LINEAR on a single-texel image in order to interpolate the two adjacent values of hamburger eatage, simple as.

[-] BatmanAoD@programming.dev 5 points 9 months ago
[-] FriendOfElphaba@sh.itjust.works 3 points 9 months ago

Perchance programming with pointers has plunged as a percentage of programmers.

But thank you. I was hoping someone would notice that.

[-] dukk@programming.dev 1 points 9 months ago* (last edited 9 months ago)

Well, you don’t really see many people accessing lists with pointers directly. Also 0-indexing does give us an extra number to index with(say 1-255 vs 0-255)

Edit: 0-255, not 0-256

[-] FriendOfElphaba@sh.itjust.works 1 points 9 months ago

It’s 0-255 when you’re indexing like that. 11111111b = 255.

[-] dukk@programming.dev 2 points 9 months ago

Oh sorry, you’re right. Amended my comment.

[-] al177@lemmy.sdf.org 52 points 9 months ago
[-] Lodra@programming.dev 19 points 9 months ago

I'm glad I'm not the only one. My son is a year and half old. I've been teaching to count on his hand in binary since day 0. He goes wild and celebrates when we reach 31 🙂

[-] radix@lemm.ee 7 points 9 months ago

My siblings and I always loved the number 4 because our puritanical mother was so casual about sticking her middle finger out at only that moment. That was just about the most taboo thing we could imagine, and it was as a result hilarious.

[-] Tippon@lemmy.dbzer0.com 2 points 9 months ago

I'm in my mid 40s, and I've never thought to count in binary on my fingers. I haven't needed to use binary for about 30 years, and I'm easily the geekiest of my friends, so I've never had an excuse to do it for fun.

You've just put a huge smile on my face.

Guess what I'm teaching my kid this week 😁

[-] obosob@feddit.uk 3 points 9 months ago

Most of the time it's not exactly useful and some of the positions are awkward (e.g. 8, 9, 10), counting to 31 on one hand is maybe useful.

More useful IMO is counting in base 6 and treating each hand as a single digit. i.e counting to 35 on 2 hands without awkward fingerings. Better than 10, less awkward than binary.

[-] Tippon@lemmy.dbzer0.com 1 points 9 months ago

We're about to start learning how to program, probably with Python, so it could be a good way to start thinking about how computers work. I never would have thought to try other systems though, so I'll look into base 6. Thanks for the suggestion :)

without awkward fingerings

Oh, the fun I would have had with that phrasing if we weren't talking about teaching kids... :D

[-] Lodra@programming.dev 1 points 9 months ago

It does take s little practice but not too much. The awkward positions are easy enough after a few weeks.

I chose binary for two reasons. First, it is occasionally useful to count that high on one hand. Second, the education when he's older. I hope this will give him a note intuitive understanding of different bases. And binary is specifically useful for understanding comported and software development. I dont intend to push him toward a career in software but I think there's a fair chance he chooses that anyways.

Plus we've made it into something fun 🙂

[-] RacoonVegetable@reddthat.com 19 points 9 months ago

Jokes on you, I use my fingers as bits for a total of 1024 numbers (0-1023). Or I can sacrifice 1 finger time be a sign bit and count negative numbers too.

[-] opensourcedeeznuts@sh.itjust.works 11 points 9 months ago

Sacrifice a few extra bits and you can do floating point arithmetic on your fingers too

[-] thor12022@kbin.social 6 points 9 months ago

Jokes on you, fingers are tri-state (fully extended, fully closed, bent at middle knuckle) not binary, so I can count to 59049.

Someone with better finger control should be able to treat them as quad-state, granting the ability to count to 1048576 by bending just the outer knuckle.

[-] amanaftermidnight@lemmy.world 3 points 9 months ago

Let's just keep multi level cells to just flash memory.

[-] TechieDamien@lemmy.ml 1 points 9 months ago

3^10-1=59048.

[-] vithigar@lemmy.ca 5 points 9 months ago

I like this idea in theory, but some combinations of fingers are very awkward to extend without the others, and one particular combination is very rude.

[-] nickhammes@lemmy.world 5 points 9 months ago

Maybe that's just because 132 is a rude number.

[-] ikapoz@sh.itjust.works 4 points 9 months ago

I’ve tried this a few times and my fingers always get really Fucking confused after about four bits.

[-] BluesF@feddit.uk 2 points 9 months ago

I can't imagine a scenario when you need to be able to do BOTH positive and negative numbers at the same time 😂

[-] QuazarOmega@lemy.lol 1 points 9 months ago

If we figure out a clever trick with phalanges we can go even further

[-] bort@lemmy.sdf.org 15 points 9 months ago

Count in binary up to 1023 on your hands you filthy casual

[-] stebo02@sopuli.xyz 7 points 9 months ago

just beware when counting the number 4 in public

[-] CanadaPlus@lemmy.sdf.org 4 points 9 months ago
[-] dukk@programming.dev 2 points 9 months ago

Especially 260.

[-] mojo@lemm.ee 12 points 9 months ago

You count one finger up as the same as no fingers up? Counting is not the same as an index.

[-] Knusper@feddit.de 10 points 9 months ago

One time, I got hit with "You're a programmer, you should be able to count." and yep, made that exact joke...

[-] conditional_soup@lemm.ee 6 points 9 months ago* (last edited 9 months ago)
def count_fingers(hand: list): 
    count = len(hand)
    if count != 5:
        if count < 5:
            raise Exception("Check if fingers missing, or just smart ass")
        else:
            raise Exception("Oh... oh no.")
    return count
[-] teamonkey@lemm.ee 4 points 9 months ago
[-] darcy@sh.itjust.works 1 points 9 months ago
[-] willeypete23@reddthat.com 3 points 9 months ago

If you count your knuckles you can get all the way up to b on one hand! Both hands can get up to 17!

[-] Swiggles@lemmy.blahaj.zone 4 points 9 months ago

Up to 355687428096000? That's impressive!

this post was submitted on 15 Sep 2023
390 points (93.5% liked)

Programmer Humor

18292 readers
1921 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS