if(x < 0) { y = -1; } else if(x == 0) { y = 0; } else { y = 1; }If you prefer to use a conditional expression, make it easy to read. The coding standards ask you to avoid complicated expressions that are difficult to read.
y = (x < 0) ? 1 : (x == 0) ? 0 : -1;