• aichan@piefed.blahaj.zone
    link
    fedilink
    English
    arrow-up
    22
    ·
    edit-2
    3 days ago

    By the end, you will understand why this code above works.

    I was utterly fooled. Looks cool though!

  • Alavi@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    3 days ago

    How do you make these types of interactive websites? (the visualizations changing for different codes)

  • underscores@lemmy.zip
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    2
    ·
    3 days ago

    What does two’s complement mean ? I don’t want a comp sci definition per se but like language one, how does saying that make sense ?

    • deepfriedchril @lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      1
      ·
      3 days ago

      It’s how you change a number to/from positive/negative.

      The basic procedure is to represent the number in binary, invert all the bits, add 1.

        • Starfighter@discuss.tchncs.de
          link
          fedilink
          arrow-up
          14
          ·
          edit-2
          3 days ago

          The same how a complementary color is the “opposite” color on the color circle. You invert all the bits to go around the number space circle (mathematically called a “field”). Opposed to normal number spaces this one is a circle since overflowing a binary number (ie all bits being 1 and adding one) will reset you back to 0.

    • AbelianGrape@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      It’s the technical name of a thing in comp sci, I’m not sure what other answer you want. It specifically contrasts “one’s complement”.