Depends if you can calculate the gradient and whether it it's known and defined. So, this all depends on the function in question. And also, the words "perfect accuracy" begs a definition here. How many decimals are we talking about here, or are we talking of all the "optimal solutions" or just one optimal solution, etc.