On Thu, 27 Jun 2013 14:37:25 -0400, Timon Gehr <[email protected]> wrote:

int f(int x){ return x?(x&1?x:-x)+(x>0?1:-1):0; }

This is similar to mine, but I like the factoring.

Still needs a special case for f(f(int.max)) which in your function returns int.max (like mine).

-Steve

Reply via email to