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.
Use J and K for navigation
Comments
24Comment deleted
The third line allocates a string just to flip a sign, which is how you know the fourth line is the real performance optimization.
x = (x ^ -1) + 1 Comment deleted
i=-i; Comment deleted
That's the 1st one Comment deleted
nah not exactly Comment deleted
- is a prefix function that returns -1*i. So it's the same with 1 more step Comment deleted
Perl: $i =~s/^/-/; Comment deleted
i = (int)((uint)(i ^ 0xFFFFFFFF) & 0x80000000); Comment deleted
just yell at it... Comment deleted
i*=-1 Comment deleted
j = 0 - i; i = 0 + j; Comment deleted
i = -(2*i-(i - i*2)) Comment deleted
i = sqrt(-1) Comment deleted
bug report: only works if i==NaN Comment deleted
bug report: NaN != NaN Comment deleted
bug report: that's javascript Comment deleted
i = (opposite_sign(i)) * i; where int opposite_sign(int x) { return x > 0 ? -1 : 1; } Comment deleted
i=-i Easy-peasy Comment deleted
i-=i--i Comment deleted
i=√-1 Comment deleted
Вы посмотрите на этого гения мысли Comment deleted
i² = -1 Comment deleted
Pardon Comment deleted
i *= -1; Comment deleted