• BorgDrone@lemmy.one
    link
    fedilink
    English
    arrow-up
    59
    arrow-down
    1
    ·
    1 year ago

    Are you indexing your fingers or counting them ?

    Indexing starts ar 0 but counting starts at 1.

    • FriendOfElphaba@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      27
      ·
      1 year 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
        link
        fedilink
        arrow-up
        10
        ·
        edit-2
        1 year 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.

        • FriendOfElphaba@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year 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
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year 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.

    • Lodra@programming.dev
      link
      fedilink
      English
      arrow-up
      19
      ·
      1 year 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
        link
        fedilink
        arrow-up
        7
        ·
        1 year 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
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year 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
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year 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.

  • RacoonVegetable@reddthat.com
    link
    fedilink
    English
    arrow-up
    19
    ·
    1 year 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.

  • Knusper@feddit.de
    link
    fedilink
    arrow-up
    10
    ·
    1 year ago

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

      • Knusper@feddit.de
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Band practice. We were playing some rapid song with changing time signatures, so everyone was struggling to count along. I just commented on it, so got some flak, but only as a joke.

  • conditional_soup@lemm.ee
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    edit-2
    1 year 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
    
          • conditional_soup@lemm.ee
            link
            fedilink
            arrow-up
            6
            arrow-down
            1
            ·
            1 year ago

            You are correct. I came back to say that I’ll use the walrus operator when it’s pushed into my cold, dead hands, but… I might actually use it, now that I’ve refreshed myself on it.