No. Given a completely general nonlinear function as a black box, so you cannot see inside the box, just pass in values, the answer is an uncategorical no.
Given a low order polynomial (of sufficiently low degree that we can do things like solve for roots of said polynomial) the problem is simpler. It would involve finding roots of a related set of polynomials, where that related set of polynomials is caused to have the constant term be adjusted carefully.
Thus for the polynomial f(x) == x^3 + x^5, we need to solve for the roots of the associated polynomials f(x)-5 and f(x)+5. Given that information, you can now determine intervals as needed. No, I won't write the code for that, because this problem is far more complex for a general blackbox function, and that is surely what you want. If it really is for the simple polynomial you wrote, that is trivial, and likely part of a homework assignment, and I don't do homework.