IsNonpositive and IsNonnegative implementation