tested and passed calculate sign and allOnSameSide functions