logoalt Hacker News

fookertoday at 10:11 AM1 replyview on HN

Not sure what you mean by advanced transformations but I got these versions from ChatGPT without explicit instructions.

  if(x-1<2&&x)...
  if((1<<x)&6)...
  if(x<3&x)...
  if(3%x&&x<3)...
  if(!((x-1)*(x-2)))
  if(!(x^1|x^2))...
  if(!(x*x-3*x+2))

Replies

listeriatoday at 2:33 PM

(1) fails for negative numbers

(2) fails for (x % 32 in [1, 2]) due to UB

(3) fails for x == 2

(4) crashes for x == 0

(5) is the same polynomial, only factorized

(6) always returns 0

(7) is the same polynomail reordered

But this works for any value of x:

  x<2==2-x
or for something shorter:

  x<3&x>0
but that's not bery obfuscated