Follow-up Comment #7, bug #39713 (project gsl):
I agree that one could design a more crisp API (like you suggest) that'll
better handle conditions like this, but you can't make the solver iteration
routine return something other than GSL_SUCCESS without breaking legacy code.
Returning GSL_CONTINUE is nonzero and you'd break existing logic looking for
failure from the iteration routine.
To stay within the current API/ABI, shortcircuiting on f == 0.0 and returning
GSL_SUCCESS may be the only feasible change. Anything else that's backwards
compatible come to mind?
As for duplicated evalution, gsl_root_fsolver_root returns the root without
requiring an additional function evaluation. The root doesn't need to be
exposed directly to the user through the iteration API as an accessor is
available to get it at near-zero cost. Again, one could imagine a different
API but this is what's in-place now. You can see this routine exercised in
the examples and the source code in fsolver.c.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39713>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/