Fixed conditional order in sign() calculations.