Generalized critical values and testing sign conditions on a polynomial