Determining the sign of a product