Skip to content
DevMeme
3378 of 7590
Languages Post #3711 · source on Telegram

Transcendent Integer Negation

Description

An expanding-brain meme is split into four horizontal rows, with code-like expressions on the left and progressively more illuminated brain images on the right. The rows read "i = i * -1", "i = i - 2*i", "i = ("-" + i.tostring).toint", and finally "i = in't" in very large bold text. The technical joke is about taking a simple operation, negating an integer, and escalating it through algebraic overwork, string conversion, and finally a pun on "int." It satirizes clever-looking but unreadable code that replaces a straightforward expression with novelty for its own sake.

Comments

24
Anonymous ★ Top Pick The third line allocates a string just to flip a sign, which is how you know the fourth line is the real performance optimization.
  1. Anonymous ★ Top Pick

    The third line allocates a string just to flip a sign, which is how you know the fourth line is the real performance optimization.

  2. @sylfn 4y

    x = (x ^ -1) + 1

  3. @RiedleroD 4y

    i=-i;

    1. @zherud 4y

      That's the 1st one

      1. @RiedleroD 4y

        nah not exactly

        1. @zherud 4y

          - is a prefix function that returns -1*i. So it's the same with 1 more step

  4. @Araalith 4y

    Perl: $i =~s/^/-/;

  5. @ZgGPuo8dZef58K6hxxGVj3Z2 4y

    i = (int)((uint)(i ^ 0xFFFFFFFF) & 0x80000000);

  6. @cotoha_1 4y

    just yell at it...

  7. @scout_ca11sign 4y

    i*=-1

  8. Deleted Account 4y

    j = 0 - i; i = 0 + j;

  9. @RiedleroD 4y

    i = -(2*i-(i - i*2))

  10. @sylfn 4y

    i = sqrt(-1)

    1. @RiedleroD 4y

      bug report: only works if i==NaN

      1. @sylfn 4y

        bug report: NaN != NaN

        1. @RiedleroD 4y

          bug report: that's javascript

  11. @sylfn 4y

    i = (opposite_sign(i)) * i; where int opposite_sign(int x) { return x > 0 ? -1 : 1; }

  12. @mrybs1 4y

    i=-i Easy-peasy

    1. @azizhakberdiev 4y

      i-=i--i

  13. @vimlover 4y

    i=√-1

    1. @mrybs1 4y

      Вы посмотрите на этого гения мысли

    2. Deleted Account 4y

      i² = -1

  14. @mrybs1 4y

    Pardon

  15. @BoxCollider2D 2y

    i *= -1;

Use J and K for navigation