Fixed sign handling in ternary operator