• Avicenna@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 month ago

      “so much of a sub that you dom” reminded me of integer overflow but sure why not (though don’t really understand it…)

      • gandalf_die_12te@lemmy.blahaj.zoneOP
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 month ago

        there’s integer overflow and integer underflow. when you have an 8-bit signed integer variable: signed char x = 127 and you try to increment it by 1: signed char y = x + 1 and then you print y: `printf(“%d\n”, int(y))", it will print -128. the reason is integer overflow, kinda like when you add 1 to 999, you get 1000. but if the variable can only store 3 digits, you get 000 instead, which is 0. the computer interprets that as a negative value though because of offset etc.

        the same works in reverse. -999 - 1 = -1000 which gets interpreted as -000 which gets interpreted as a positive number then.

        • Avicenna@programming.dev
          link
          fedilink
          English
          arrow-up
          3
          ·
          1 month ago

          Hah for some reason I thought it was arithmetic underflow but given that the original joke was integer overflow and not arithmetic overflow it makes more sense for it to be integer underflow too. And I agree fits better.