all 13 comments

sorted by: hot top controversial new old
[–] 29 points 2 months ago* (1 child)

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

I was utterly fooled. Looks cool though!

  • source
  • hideshow 1 child comment
  • [–] 2 points 2 months ago

    It assumes that you already know how modulus works under the hood, which I absolutely did not. The proof for how it's allowed is at the bottom which I would have read first if I'd have known.

  • source
  • parent
  • [–] 8 points 2 months ago

    This is a freaking good read.

  • source
  • [–] 4 points 2 months ago (2 children)

    Bookmarked to read later. Looks interesting from first sight

  • source
  • hideshow 2 child comments
  • [–] 3 points 2 months ago

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

  • source
  • [–] 2 points 2 months ago (5 children)

    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 ?

  • source
  • hideshow 5 child comments
  • [–] 9 points 2 months ago (3 children)

    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.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 2 months ago (2 children)

    How does that relate to the word "complement"

  • source
  • parent
  • hideshow 2 child comments
  • [–] 17 points 2 months ago* (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment